public Morphology(Reader in, int flags) { lexer = new Morpha(in); lexer.setOptions(flags); }
if (DEBUG) log.info("Trying to normalize |" + wordtag + '|'); try { lexer.setOption(1, lowercase); lexer.yyreset(new StringReader(wordtag)); lexer.yybegin(Morpha.scan); String wordRes = lexer.next(); lexer.next(); // go past tag if (wordHasForbiddenChar) { if (DEBUG) log.info("Restoring forbidden chars");
public String lemma(String word, String tag) { return lemmatize(word, tag, lexer, lexer.option(1)); }
/** * Process morphologically words from a Reader. * * @param in The Reader to read from */ public Morphology(Reader in) { lexer = new Morpha(in); }
public Word next() throws IOException { String nx = lexer.next(); if (nx == null) { return null; } else { return new Word(nx); } }
private static synchronized void initStaticLexer() { if (staticLexer == null) { staticLexer = new Morpha(new InputStreamReader(System.in)); } }
public Word next() throws IOException { String nx = lexer.next(); if (nx == null) { return null; } else { return new Word(nx); } }
if (DEBUG) System.err.println("Trying to normalize |" + wordtag + "|"); try { lexer.setOption(1, lowercase); lexer.yyreset(new StringReader(wordtag)); lexer.yybegin(Morpha.scan); String wordRes = lexer.next(); lexer.next(); // go past tag if (wordHasForbiddenChar) { if (DEBUG) System.err.println("Restoring forbidden chars");
/** Return a new WordTag which has the lemma as the value of word(). * The default is to lowercase non-proper-nouns, unless options have * been set. */ public static synchronized WordTag stemStatic(String word, String tag) { initStaticLexer(); return new WordTag(lemmatize(word, tag, staticLexer, staticLexer.option(1)), tag); }
public Morphology(Reader in, int flags) { lexer = new Morpha(in); lexer.setOptions(flags); }
public Morphology() { lexer = new Morpha(new InputStreamReader(System.in)); }
public Word next() throws IOException { String nx = lexer.next(); if (nx == null) { return null; } else { return new Word(nx); } }
if (DEBUG) System.err.println("Trying to normalize |" + wordtag + "|"); try { lexer.setOption(1, lowercase); lexer.yyreset(new StringReader(wordtag)); lexer.yybegin(Morpha.scan); String wordRes = lexer.next(); lexer.next(); // go past tag if (wordHasForbiddenChar) { if (DEBUG) System.err.println("Restoring forbidden chars");
/** * Adds stem under annotation {@code ann} to the given CoreLabel. * Assumes that it has a TextAnnotation and PartOfSpeechAnnotation. */ public void stem(CoreLabel label, Class<? extends CoreAnnotation<String>> ann) { String lemma = lemmatize(label.word(), label.tag(), lexer, lexer.option(1)); label.set(ann, lemma); }
public Morphology(Reader in, int flags) { lexer = new Morpha(in); lexer.setOptions(flags); }
/** * Process morphologically words from a Reader. * * @param in The Reader to read from */ public Morphology(Reader in) { lexer = new Morpha(in); }