You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@joshua.apache.org by "Tommaso Teofili (JIRA)" <ji...@apache.org> on 2019/05/10 09:59:00 UTC

[jira] [Commented] (JOSHUA-342) Use replace() instead of replaceAll() when no regex pattern is used

    [ https://issues.apache.org/jira/browse/JOSHUA-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16837127#comment-16837127 ] 

Tommaso Teofili commented on JOSHUA-342:
----------------------------------------

after applying the patch some tests fail with the following output:
{noformat}
Results :

Failed tests: 
  BnEnDecodingTest.givenBnEnInput_whenPhraseDecodingWithBerkeleyLM_thenScoreAndTranslationCorrect:71 Lists differ at element [707]: "-446.865 germany -lrb- in german : deutschland ডয়চ্ the লান্ট্ of pronounced [ dɔʏtʃlant through ] -rrb- is a country of europe ." != "-651.415 germany -lrb- in german : deutschland ডয়চ্ the লান্ট্ of pronounced [ dɔʏtʃlant ] through -rrb- is a country of europe ." expected ["-446.865 germany -lrb- in german : deutschland ডয়চ্ the লান্ট্ of pronounced [ dɔʏtʃlant through ] -rrb- is a country of europe ."] but found ["-651.415 germany -lrb- in german : deutschland ডয়চ্ the লান্ট্ of pronounced [ dɔʏtʃlant ] through -rrb- is a country of europe ."]
  DoNotCrashTest.givenProblematicInput_whenDecoding_thenNoCrash:56 » IllegalState
  FormatUtilsTest.givenSpecialSymbols_whenEscapeSpecialSymbols_thenCorrectlyEscaped:68 expected:<[ ] | [> but was:<-lsb- -rsb- -pipe- -lsb->

Tests run: 139, Failures: 3, Errors: 0, Skipped: 27
{noformat}

> Use replace() instead of replaceAll() when no regex pattern is used
> -------------------------------------------------------------------
>
>                 Key: JOSHUA-342
>                 URL: https://issues.apache.org/jira/browse/JOSHUA-342
>             Project: Joshua
>          Issue Type: Improvement
>            Reporter: bd2019us
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: JOSHUA-342.patch
>
>
> ReplaceAll() has extra unneeded overhead when it is used without a regex argument. Use replace() instead to remove this overhead.
> Affected files:
> * src/main/java/org/apache/joshua/util/FormatUtils.java
> * src/main/java/org/apache/joshua/corpus/syntax/ArraySyntaxTree.java
> * src/main/java/org/apache/joshua/decoder/ff/FeatureVector.java
> * src/main/java/org/apache/joshua/mira/MIRACore.java
> * src/main/java/org/apache/joshua/zmert/MertCore.java



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)