/** * Initializes the current instance with given samples * and a {@link DefaultPOSContextGenerator}. * @param samples */ public POSSampleEventStream(ObjectStream<POSSample> samples) { this(samples, new DefaultPOSContextGenerator(null)); }
public POSSampleSequenceStream(ObjectStream<POSSample> psi) throws IOException { this(psi, new DefaultPOSContextGenerator(null)); }
public AbstractParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype, Dictionary dict) { super(d); this.dict = dict; if (etype == ParserEventTypeEnum.CHUNK) { this.chunkerContextGenerator = new ChunkContextGenerator(); } else if (etype == ParserEventTypeEnum.TAG) { this.tagContextGenerator = new DefaultPOSContextGenerator(null); } this.rules = rules; punctSet = rules.getPunctuationTags(); this.etype = etype; init(); }
public POSContextGenerator getPOSContextGenerator(int cacheSize) { if (artifactProvider != null) { Properties manifest = (Properties) artifactProvider.getArtifact("manifest.properties"); String version = manifest.getProperty("OpenNLP-Version"); if (Version.parse(version).getMinor() < 8) { return new DefaultPOSContextGenerator(cacheSize, getDictionary()); } } return new ConfigurablePOSContextGenerator(cacheSize, createFeatureGenerators()); }
@BeforeClass public static void setUp() { final String matchingToken = "tokenC"; tokens = new Object[] {"tokenA", "tokenB", matchingToken, "tokenD"}; final StringList stringList = new StringList(new String[] {matchingToken}); Dictionary dictionary = new Dictionary(); dictionary.put(stringList); defaultPOSContextGenerator = new DefaultPOSContextGenerator(dictionary); tags = new String[] {"tagA", "tagB", "tagC", "tagD"}; }
public POSSampleSequenceStream(ObjectStream<POSSample> psi) throws IOException { this(psi, new DefaultPOSContextGenerator(null)); }
/** * Initializes the current instance with given samples * and a {@link DefaultPOSContextGenerator}. * @param samples */ public POSSampleEventStream(ObjectStream<POSSample> samples) { this(samples, new DefaultPOSContextGenerator(null)); }
/** * Initializes the current instance with given samples * and a {@link DefaultPOSContextGenerator}. * @param samples */ public POSSampleEventStream(ObjectStream<POSSample> samples) { this(samples, new DefaultPOSContextGenerator(null)); }
public POSSampleSequenceStream(ObjectStream<POSSample> psi) throws IOException { this(psi, new DefaultPOSContextGenerator(null)); }
/** * * @param samples * @param tagDictionary * @param ngramDictionary * @param cutoff * * @throws IOException its throws if an {@link IOException} is thrown * during IO operations on a temp file which is created during training occur. */ public static POSModel train(String languageCode, ObjectStream<POSSample> samples, POSDictionary tagDictionary, Dictionary ngramDictionary, int cutoff, int iterations) throws IOException { GISModel posModel = opennlp.maxent.GIS.trainModel(iterations, new TwoPassDataIndexer(new POSSampleEventStream(samples, new DefaultPOSContextGenerator(ngramDictionary)), cutoff)); return new POSModel(languageCode, posModel, tagDictionary, ngramDictionary); }
public AbstractParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype, Dictionary dict) { super(d); this.dict = dict; if (etype == ParserEventTypeEnum.CHUNK) { this.chunkerContextGenerator = new ChunkContextGenerator(); } else if (etype == ParserEventTypeEnum.TAG) { this.tagContextGenerator = new DefaultPOSContextGenerator(null); } this.rules = rules; punctSet = rules.getPunctuationTags(); this.etype = etype; init(); }
public AbstractParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype, Dictionary dict) { super(d); this.dict = dict; if (etype == ParserEventTypeEnum.CHUNK) { this.chunkerContextGenerator = new ChunkContextGenerator(); } else if (etype == ParserEventTypeEnum.TAG) { this.tagContextGenerator = new DefaultPOSContextGenerator(null); } this.rules = rules; punctSet = rules.getPunctuationTags(); this.etype = etype; init(); }
public POSContextGenerator getPOSContextGenerator(int cacheSize) { if (artifactProvider != null) { Properties manifest = (Properties) artifactProvider.getArtifact("manifest.properties"); String version = manifest.getProperty("OpenNLP-Version"); if (Version.parse(version).getMinor() < 8) { return new DefaultPOSContextGenerator(cacheSize, getDictionary()); } } return new ConfigurablePOSContextGenerator(cacheSize, createFeatureGenerators()); }
public POSContextGenerator getPOSContextGenerator(int cacheSize) { if (artifactProvider != null) { Properties manifest = (Properties) artifactProvider.getArtifact("manifest.properties"); String version = manifest.getProperty("OpenNLP-Version"); if (Version.parse(version).getMinor() < 8) { return new DefaultPOSContextGenerator(cacheSize, getDictionary()); } } return new ConfigurablePOSContextGenerator(cacheSize, createFeatureGenerators()); }
POSContextGenerator cg = new DefaultPOSContextGenerator(new Dictionary(new FileInputStream(dict))); POSContextGenerator cg = new DefaultPOSContextGenerator(new Dictionary(new FileInputStream(dict))); POSContextGenerator cg = new DefaultPOSContextGenerator(new Dictionary(new FileInputStream(dict))); POSContextGenerator cg = new DefaultPOSContextGenerator(new Dictionary(new FileInputStream(dict)));