Codota Logo
opennlp.tools.namefind
Code IndexAdd Codota to your IDE (free)

How to use opennlp.tools.namefind

Best Java code snippets using opennlp.tools.namefind (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: apache/opennlp

public TokenNameFinderModel(String languageCode, MaxentModel nameFinderModel,
  byte[] generatorDescriptor, Map<String, Object> resources, Map<String, String> manifestInfoEntries) {
 this(languageCode, nameFinderModel, NameFinderME.DEFAULT_BEAM_SIZE,
   generatorDescriptor, resources, manifestInfoEntries, new BioCodec(), new TokenNameFinderFactory());
}
origin: apache/opennlp

/**
 * Creates a {@link TokenNameFinderFactory} that provides the default implementation
 * of the resources.
 */
public TokenNameFinderFactory() {
 this.seqCodec = new BioCodec();
}
origin: apache/opennlp

public SequenceCodec<String> getSequenceCodec() {
 return this.getFactory().getSequenceCodec();
}
origin: apache/opennlp

@SuppressWarnings("unchecked")
public Event[] updateContext(Sequence sequence, AbstractModel model) {
 TokenNameFinder tagger = new NameFinderME(new TokenNameFinderModel(
   "x-unspecified", model, Collections.emptyMap(), null));
 String[] sentence = ((Sequence<NameSample>) sequence).getSource().getSentence();
 String[] tags = seqCodec.encode(tagger.find(sentence), sentence.length);
 Event[] events = new Event[sentence.length];
 NameFinderEventStream.generateEvents(sentence,tags,pcg).toArray(events);
 return events;
}
origin: apache/opennlp

@Override
protected TokenNameFinderModel loadModel(InputStream modelIn) throws IOException {
 return new TokenNameFinderModel(modelIn);
}
origin: apache/opennlp

public NameFinderME(TokenNameFinderModel model) {
 TokenNameFinderFactory factory = model.getFactory();
 seqCodec = factory.createSequenceCodec();
 sequenceValidator = seqCodec.createSequenceValidator();
 this.model = model.getNameFinderSequenceModel();
 contextGenerator = factory.createContextGenerator();
 // TODO: We should deprecate this. And come up with a better solution!
 contextGenerator.addFeatureGenerator(
     new WindowFeatureGenerator(additionalContextFeatureGenerator, 8, 8));
}
origin: apache/opennlp

@Test
public void testNoFilter() throws IOException {
 final String[] types = new String[] {};
 filter = new NameSampleTypeFilter(types, sampleStream(text));
 NameSample ns = filter.read();
 Assert.assertEquals(0, ns.getNames().length);
}
origin: apache/opennlp

protected Span[] find(CAS cas, String[] tokens) {
 return mNameFinder.find(tokens);
}
origin: apache/opennlp

 @Override
 protected String[] toSentence(NameSample sample) {
  return sample.getSentence();
 }
}
origin: apache/opennlp

/**
 * Returns a RegexNamefinder that will utilize specified default regexes.
 *
 * @param defaults the OpenNLP default regexes
 * @return {@link RegexNameFinder}
 */
public static synchronized RegexNameFinder getDefaultRegexNameFinders(
  DEFAULT_REGEX_NAME_FINDER... defaults) {
 Objects.requireNonNull(defaults, "defaults must not be null");
 return new RegexNameFinder(defaultsToMap(defaults));
}
origin: apache/opennlp

public NameSampleSequenceStream(ObjectStream<NameSample> psi,
  AdaptiveFeatureGenerator featureGen, boolean useOutcomes)
  throws IOException {
 this(psi, new DefaultNameContextGenerator(featureGen), useOutcomes);
}
origin: apache/opennlp

/**
 * Forgets all adaptive data which was collected during previous calls to one
 * of the find methods.
 *
 * This method is typical called at the end of a document.
 */
public void clearAdaptiveData() {
 contextGenerator.clearAdaptiveData();
}
origin: apache/opennlp

/**
 * NEW. This method removes the need for tokenization, but returns the Span
 * with character indices, rather than word.
 *
 * @param text
 * @return
 */
public Span[] find(String text) {
 return getAnnotations(text);
}
origin: apache/opennlp

@Override
public SequenceValidator<String> createSequenceValidator() {
 return new BilouNameFinderSequenceValidator();
}
origin: apache/opennlp

public TokenNameFinderFactory(byte[] featureGeneratorBytes, final Map<String, Object> resources,
  SequenceCodec<String> seqCodec) {
 init(featureGeneratorBytes, resources, seqCodec);
}
origin: apache/opennlp

 public static NameSample createPredSample() {
  return createSimpleNameSample(false);
 }
}
origin: apache/opennlp

@Override
protected TokenNameFinderModel loadModel(InputStream in) throws IOException {
 return new TokenNameFinderModel(in);
}
origin: apache/opennlp

public TokenNameFinderCrossValidator(String languageCode, String type,
  TrainingParameters trainParams, byte[] featureGeneratorBytes,
  Map<String, Object> resources,
  TokenNameFinderEvaluationMonitor... listeners) {
 this(languageCode, type, trainParams, featureGeneratorBytes, resources, new BioCodec(), listeners);
}
origin: apache/opennlp

public NameSampleSequenceStream(ObjectStream<NameSample> psi, AdaptiveFeatureGenerator featureGen)
  throws IOException {
 this(psi, new DefaultNameContextGenerator(featureGen), true);
}
origin: apache/opennlp

public NameSampleSequenceStream(ObjectStream<NameSample> psi, NameContextGenerator pcg, boolean useOutcomes)
  throws IOException {
 this(psi, pcg, useOutcomes, new BioCodec());
}
opennlp.tools.namefind

Most used classes

  • NameFinderME
    Class for creating a maximum-entropy-based name finder.
  • TokenNameFinderModel
    The TokenNameFinderModel is the model used by a learnable TokenNameFinder.
  • NameSample
    Class for holding names for a single unit of text.
  • TokenNameFinder
    The interface for name finders which provide name tags for a sequence of tokens.
  • NameSampleDataStream
    The NameSampleDataStream class converts tagged Strings provided by a DataStream to NameSample object
  • BioCodec,
  • TokenNameFinderEvaluator,
  • DictionaryNameFinder,
  • NameFinderEventStream,
  • NameSampleTypeFilter,
  • TokenNameFinderCrossValidator,
  • BilouNameFinderSequenceValidator,
  • DefaultNameContextGenerator,
  • NameFinderSequenceValidator,
  • RegexNameFinder,
  • RegexNameFinderFactory,
  • NameContextGenerator,
  • NameSampleSequenceStream,
  • RegexNameFinderFactory$DEFAULT_REGEX_NAME_FINDER$1
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now