Skip to content

Commit

Permalink
Merge pull request #27 from stanfordnlp/terminology
Browse files Browse the repository at this point in the history
configure TM as terminology model
  • Loading branch information
joewue committed Sep 23, 2017
2 parents bc2ca5c + 5df38f4 commit be69585
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/edu/stanford/nlp/mt/tm/DynamicTranslationModel.java
Expand Up @@ -303,6 +303,28 @@ public synchronized void configureAsForegroundTM(DynamicTranslationModel<FV> bac
logger.info("Timing results: {}", timer);
}

/**
* Configure this TM as a terminology model.
*
* @param name
*/
public synchronized void configureAsTerminologyModel(String name) {
TimeKeeper timer = TimingUtils.start();
maxSourcePhrase = DEFAULT_MAX_PHRASE_LEN;
maxTargetPhrase = DEFAULT_MAX_PHRASE_LEN;
sampleSize = DEFAULT_SAMPLE_SIZE;
name = name;
reorderingEnabled = false;
setFeatureTemplate(FeatureTemplate.DENSE);

createIdArrays();
timer.mark("Id arrays");
createLexCoocTable(sa.getVocabulary().size());
timer.mark("Cooc table");
logger.info("Timing results: {}", timer);
}


/**
* Create a query cache of frequent rules. Extract rules from
* the cache in parallel.
Expand Down

0 comments on commit be69585

Please sign in to comment.