public static List<Event> generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg) { List<Event> events = new ArrayList<>(outcomes.length); for (int i = 0; i < outcomes.length; i++) { events.add(new Event(outcomes[i], cg.getContext(i, sentence, outcomes,null))); } cg.updateAdaptiveData(sentence, outcomes); return events; }
/** * Generates name tags for the given sequence, typically a sentence, returning * token spans for any identified names. * * @param tokens an array of the tokens or words of the sequence, typically a sentence. * @param additionalContext features which are based on context outside of the * sentence but which should also be used. * * @return an array of spans for each of the names identified. */ public Span[] find(String[] tokens, String[][] additionalContext) { additionalContextFeatureGenerator.setCurrentContext(additionalContext); bestSequence = model.bestSequence(tokens, additionalContext, contextGenerator, sequenceValidator); List<String> c = bestSequence.getOutcomes(); contextGenerator.updateAdaptiveData(tokens, c.toArray(new String[c.size()])); Span[] spans = seqCodec.decode(c); spans = setProbs(spans); return spans; }
public static List<Event> generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg) { List<Event> events = new ArrayList<>(outcomes.length); for (int i = 0; i < outcomes.length; i++) { events.add(new Event(outcomes[i], cg.getContext(i, sentence, outcomes,null))); } cg.updateAdaptiveData(sentence, outcomes); return events; }
public static List<Event> generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg) { List<Event> events = new ArrayList<>(outcomes.length); for (int i = 0; i < outcomes.length; i++) { events.add(new Event(outcomes[i], cg.getContext(i, sentence, outcomes,null))); } cg.updateAdaptiveData(sentence, outcomes); return events; }
/** * Generates name tags for the given sequence, typically a sentence, returning * token spans for any identified names. * * @param tokens an array of the tokens or words of the sequence, typically a sentence. * @param additionalContext features which are based on context outside of the * sentence but which should also be used. * * @return an array of spans for each of the names identified. */ public Span[] find(String[] tokens, String[][] additionalContext) { additionalContextFeatureGenerator.setCurrentContext(additionalContext); bestSequence = model.bestSequence(tokens, additionalContext, contextGenerator, sequenceValidator); List<String> c = bestSequence.getOutcomes(); contextGenerator.updateAdaptiveData(tokens, c.toArray(new String[c.size()])); Span[] spans = seqCodec.decode(c); spans = setProbs(spans); return spans; }
/** * Generates name tags for the given sequence, typically a sentence, returning * token spans for any identified names. * * @param tokens an array of the tokens or words of the sequence, typically a sentence. * @param additionalContext features which are based on context outside of the * sentence but which should also be used. * * @return an array of spans for each of the names identified. */ public Span[] find(String[] tokens, String[][] additionalContext) { additionalContextFeatureGenerator.setCurrentContext(additionalContext); bestSequence = model.bestSequence(tokens, additionalContext, contextGenerator, sequenceValidator); List<String> c = bestSequence.getOutcomes(); contextGenerator.updateAdaptiveData(tokens, c.toArray(new String[c.size()])); Span[] spans = seqCodec.decode(c); spans = setProbs(spans); return spans; }