Package opennlp.tools.postag

Examples of opennlp.tools.postag.POSDictionary


    if (tagDictionaryName != null) {
      try {
        InputStream dictIn = AnnotatorUtil.getResourceAsStream(mContext, tagDictionaryName);

        // TODO: ask Tom if case sensitivity must be configureable
        tagDictionary = new POSDictionary(new BufferedReader(new InputStreamReader(dictIn)), false);

      } catch (final IOException e) {
        // if this fails just print error message and continue
        final String message = "IOException during tag dictionary reading, "
            + "running without tag dictionary: " + e.getMessage();
View Full Code Here


    if (tagDictionaryName != null) {
      try {
        InputStream dictIn = AnnotatorUtil.getResourceAsStream(mContext, tagDictionaryName);

        // TODO: ask Tom if case sensitivity must be configureable
        tagDictionary = new POSDictionary(new BufferedReader(new InputStreamReader(dictIn)), false);

      } catch (final IOException e) {
        // if this fails just print error message and continue
        final String message = "IOException during tag dictionary reading, "
            + "running without tag dictionary: " + e.getMessage();
View Full Code Here

          Integer.toString(params.getCutoff()));
    }
   
    try {
      // TODO: Move to util method ...
      POSDictionary tagdict = null;
      if (params.getDict() != null) {
        tagdict = POSDictionary.create(new FileInputStream(params.getDict()));
      }

      validator = new POSTaggerCrossValidator(params.getLang(), mlParams,
View Full Code Here

   
    POSModel model;
    try {
     
      // TODO: Move to util method ...
      POSDictionary tagdict = null;
      if (params.getDict() != null) {
        tagdict = POSDictionary.create(new FileInputStream(params.getDict()));
      }
     
      if (mlParams == null) {
View Full Code Here

      }
    }
    POSTaggerME tagger;
    String modelFile = args[ai++];
    if (tagdict != null) {
      tagger = new PosTagger(modelFile, new POSDictionary(tagdict));
    }
    else {
      tagger = new PosTagger(modelFile);
    }
    if (test) {
View Full Code Here

  public ParserTagger(String modelFile, String tagDictionary, boolean useCase, Dictionary dict) throws IOException {
    this(modelFile,K,dict,tagDictionary,useCase,K);
  }
 
  public ParserTagger(String modelFile, int beamSize, Dictionary dict, String tagDictionary, boolean useCase, int cacheSize) throws IOException {
    super(beamSize, new SuffixSensitiveGISModelReader(new File(modelFile)).getModel(), new DefaultPOSContextGenerator(cacheSize,dict), new POSDictionary(tagDictionary, useCase));
    this.beamSize = beamSize;
  }
View Full Code Here

      dictFile = args[ai++];
    }
   
    if (tagdict != null) {
      if (dictFile != null) {
        tagger = new PosTagger(model,new Dictionary(dictFile),new POSDictionary(tagdict,caseSensitive));
      }
      else {
        tagger = new PosTagger(model,new POSDictionary(tagdict,caseSensitive));
      }
    }
    else {
      if (dictFile != null) {
        tagger = new PosTagger(model,new Dictionary(dictFile));
View Full Code Here

    // model.getFile() +
    // " dictionary: "+dictionary.getFile());
    try {
      BufferedReader dictionaryReader = new BomStrippingInputStreamReader(dictionary.openStream(),
              dictionaryEncoding);
      pos = new POSTaggerME(getModel(model), new POSDictionary(
          dictionaryReader, true));
    } catch (IOException e) {
      e.printStackTrace();
      logger.error("OpenNLP POS can not be initialized!");
      throw new RuntimeException("OpenNLP POS can not be initialized!", e);
View Full Code Here

    if (tagDictionaryName != null) {
      try {
        InputStream dictIn = AnnotatorUtil.getResourceAsStream(mContext, tagDictionaryName);

        // TODO: ask Tom if case sensitivity must be configureable
        tagDictionary = new POSDictionary(new BufferedReader(new InputStreamReader(dictIn)), false);

      } catch (final IOException e) {
        // if this fails just print error message and continue
        final String message = "IOException during tag dictionary reading, "
            + "running without tag dictionary: " + e.getMessage();
View Full Code Here

          File f = new File(d, "pos.model.bin");
          //File f = new File(d, "tag.bin.gz");
          MaxentModel posModel = new opennlp.maxent.io.SuffixSensitiveGISModelReader(f).getModel();
          if (useTagDictionary) {
            File td = new File(d, "tagdict");
            TagDictionary tagDictionary = new POSDictionary(td.getAbsolutePath()); //null;
            posTagger = new POSTaggerME((AbstractModel) posModel, tagDictionary);
          } else {
            // f = new File(d, "dict.bin.gz");
            Dictionary dictionary = null; // new Dictionary();
            posTagger = new POSTaggerME((AbstractModel) posModel, dictionary);
View Full Code Here

TOP

Related Classes of opennlp.tools.postag.POSDictionary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.