Orders first by word, then by lemma, then by tag.

@param wordLemmaTag object to compare to
@return result (positive if <code>this</code> is greater than
<code>obj</code>, 0 if equal, negative otherwise)
425023
public int compareTo(WordLemmaTag wordLemmaTag) {
    int first = word().compareTo(wordLemmaTag.word());
    if (first != 0)
      return first;
    int second = lemma().compareTo(wordLemmaTag.lemma());
    if (second != 0)
      return second;
    else
      return tag().compareTo(wordLemmaTag.tag());
  }
1335654
public final Morpheme createMorpheme(final String word, final String tag) {
    final Morpheme morpheme = new Morpheme();
    morpheme.setValue(word);
    morpheme.setTag(tag);
    return morpheme;
  }
933750
public synchronized static String lemmatize(String text, String posTag) {
        LemmataEntry lemmata = getLemmatizer().lemmatizeByLexiconAndRules(text,
                posTag);

        Collection<edu.ucdenver.ccp.nlp.biolemmatizer.LemmataEntry.Lemma> lemmas = lemmata
                .getLemmas();
        if (!lemmas.isEmpty()) {
            edu.ucdenver.ccp.nlp.biolemmatizer.LemmataEntry.Lemma lemma = lemmas
                    .iterator().next();
            return lemma.getLemma();
        } else {
            return null;
        }
    }
65132
private Grammar getEqualGrammar(Grammar gr) {

		for (Grammar gx : this.grammars) {
			if (gr == gx) {
				// System.out.println("Exactly the same grammar found: " + gx);
				return gx;
			}

			if (isSameGrammarType(gr, gx)) {
				// type of grammar the same

				if (gr.getNumberOfEvents() == gx.getNumberOfEvents()) {
					List<Grammar> handled = new ArrayList<Grammar>();
					if (isEqualGrammar(gr, gx, handled)) {
						// the same grammar found
						// System.out.println("Same grammar found for: " + gx +
						// " == " + gr);
						return gx;
					}
				}
			}

		}

		return null;
	}
249936
function precedenceAdjustmentSpecification(word){
    var regex_rules = [
        /^be(.*)lah$/,
        /^be(.*)an$/,
        /^me(.*)i$/,
        /^di(.*)i$/,
        /^pe(.*)i$/,
        /^ter(.*)i$/,
    ];

    for(var i in regex_rules){
        if(word.match(regex_rules[i])){
            return true;
        }
    }
    return false;
}
980525
function getElseKeyword(node) {
            return node.alternate && sourceCode.getFirstTokenBetween(node.consequent, node.alternate, isElseKeywordToken);
        }
286529
private HashMap<List<String>, String> getLemmaTagsDict(final String word) {
    final List<WordData> wdList = this.dictLookup.lookup(word);
    final HashMap<List<String>, String> dictMap = new HashMap<List<String>, String>();
    for (final WordData wd : wdList) {
      final List<String> wordLemmaTags = new ArrayList<String>();
      wordLemmaTags.add(word);
      wordLemmaTags.add(wd.getTag().toString());
      dictMap.put(wordLemmaTags, wd.getStem().toString());
    }
    return dictMap;
  }
704934
private static String lemmatize(String word, String tag, Morpha lexer, boolean lowercase) {
    boolean wordHasForbiddenChar = word.indexOf('_') >= 0 ||word.indexOf(' ') >= 0;
    String quotedWord = word;
    if (wordHasForbiddenChar) {
      // choose something unlikely. Classical Vedic!
      quotedWord = quotedWord.replaceAll("_", "\u1CF0");
      quotedWord = quotedWord.replaceAll(" ", "\u1CF1");
    }
    String wordtag = quotedWord + '_' + tag;
    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");
        wordRes = wordRes.replaceAll("\u1CF0", "_");
        wordRes = wordRes.replaceAll("\u1CF1", " ");
      }
      return wordRes;
    } catch (IOException e) {
      LOGGER.warning("Morphology.stem() had error on word " + word + "/" + tag);
      return word;
    }
  }
349613
public Lemma getLemma() {
    if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_lemma == null)
      jcasType.jcas.throwFeatMissing("lemma", "de.julielab.jules.types.Token");
    return (Lemma)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_lemma)));}
143800
public static final <T extends Comparable<T>> Ordering<Scored<T>> ByScoreThenByItem(
      Ordering<T> itemOrdering) {
    final Ordering<Scored<T>> byItem = itemOrdering.onResultOf(Scoreds.<T>itemsOnly());
    final Ordering<Scored<T>> byScore = Scoreds.<T>ByScoreOnly();

    return Ordering.compound(ImmutableList.of(byScore, byItem));
  }
351343
private boolean isPhraseOrClause(String tag) {
        // find out why adding more reduced the number of relations
        return
            (!tag.equals("SYM") &&
             tag.startsWith("S")) ||
            tag.equals("ADJP") ||
            tag.equals("ADVP") ||
            tag.equals("CONJP") ||
            tag.equals("FRAG") ||
            tag.equals("INTJ") ||
            tag.equals("LST") ||
            tag.equals("NAC") ||
            tag.equals("NP") ||
            tag.equals("NX") ||
            tag.equals("PP") ||
            tag.equals("PRN") ||
            /* removing prt adds 1% more relations */
            tag.equals("PRT") ||
            tag.equals("QP") ||
            tag.equals("RRC") ||
            tag.equals("UCP") ||
            tag.equals("VP") ||
            tag.startsWith("WH") ||
            tag.equals("X");
    }
1346635
public int compareTo(final Vertex<T> o)
    {
        int orderInd;

        if (m_order < o.m_order)
        {
            orderInd = -1;
        }
        else if (m_order > o.m_order)
        {
            orderInd = 1;
        }
        else
        {
            orderInd = 0;
        }

        return orderInd;
    }
477888
protected Expression term() {
        Expression left = product();
        if (tokenizer.current().isSymbol("+")) {
            tokenizer.consume();
            Expression right = term();
            return reOrder(left, right, BinaryOperation.Op.ADD);
        }
        if (tokenizer.current().isSymbol("-")) {
            tokenizer.consume();
            Expression right = term();
            return reOrder(left, right, BinaryOperation.Op.SUBTRACT);
        }
        if (tokenizer.current().isNumber()) {
            if (tokenizer.current().getContents().startsWith("-")) {
                Expression right = term();
                return reOrder(left, right, BinaryOperation.Op.ADD);
            }
        }

        return left;
    }
596331
public String tag(final String word, final String postag) {
    // lookup postag as value of the map
    String newPosTag = this.dictMap.get(word.toLowerCase());
    if (newPosTag == null) {
      newPosTag = postag;
    }
    return newPosTag;
  }
998234
public static boolean isWord(String wordString) {
        return Optional.ofNullable(wordPattern)
                .orElseGet(() -> wordPattern = Pattern.compile(WordPattern))
                .matcher(wordString).matches();
    }
1279862
def _makeListOfCompletions(self, wordBeforeCursor, wholeWord):
        
        onlySuitable = [word for word in self._wordSet \
                                if word.startswith(wordBeforeCursor) and \
                                   word != wholeWord]

        return sorted(onlySuitable)
1360573
@Override
    public String[] tag(List<String> wordList)
    {
        String[] termArray = new String[wordList.size()];
        wordList.toArray(termArray);
        return tag(termArray);
    }