tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Mattmann" <mattm...@apache.org>
Subject Re: Review Request 23562: Add a CachedTranslator implementation
Date Thu, 17 Jul 2014 17:12:31 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/23562/#review48019
-----------------------------------------------------------

Ship it!


Ship It!

- Chris Mattmann


On July 17, 2014, 4 p.m., Tyler Palsulich wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/23562/
> -----------------------------------------------------------
> 
> (Updated July 17, 2014, 4 p.m.)
> 
> 
> Review request for tika and Chris Mattmann.
> 
> 
> Bugs: tika-1370
>     https://issues.apache.org/jira/browse/tika-1370
> 
> 
> Repository: tika
> 
> 
> Description
> -------
> 
> This patch introduces a simple cached translator. Underneath, there is a normal translator
(passed in through the constructor) and a HashMap. Every translate request is first tested
if the text is already in the cache -- returning the cached value if so.
> 
> Specifically, the cache is a HashMap<String, HashMap<String, String>>. The
outer map is indexed by "[sourceLanguage]:[targetLanguage]". The inner map is indexed by the
text to translate.
> 
> There are helper methods to check if the cache contains a certain translation, check
how many different source/target languages are cached, and check how many different translations
a certain source/target pair has.
> 
> 
> Diffs
> -----
> 
>   trunk/tika-translate/src/main/java/org/apache/tika/language/translate/CachedTranslator.java
PRE-CREATION 
>   trunk/tika-translate/src/main/resources/META-INF/services/org.apache.tika.language.translate.Translator
1611391 
>   trunk/tika-translate/src/test/java/org/apache/tika/language/translate/CachedTranslatorTest.java
PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/23562/diff/
> 
> 
> Testing
> -------
> 
> Unit tests for ensuring a request repeated 20 times only has one cache entry, two requests
repeated 20 times only lead to two cache entries, a simple translation actually works, and
a check that the contains methods actually work.
> 
> 
> Thanks,
> 
> Tyler Palsulich
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message