コード例 #1
0
ファイル: Lexicon.java プロジェクト: kevinkissi/openccg
 /** Returns the lexical signs indexed by the given rel, or null if none. */
 public Collection<Sign> getSignsFromRel(String rel) {
   // check cache (if not doing supertagging)
   if (_supertagger == null) {
     RelLookup lookup = new RelLookup(rel);
     RelLookup retLookup = (RelLookup) lookupCache.getInterned(lookup);
     if (retLookup != null) return retLookup.signs;
   }
   // lookup signs via preds
   Collection<String> preds = (Collection<String>) _relsToPreds.get(rel);
   if (preds == null) return null;
   Collection<Sign> retval = getSignsFromRelAndPreds(rel, preds);
   // cache non-null result (if not doing supertagging)
   if (_supertagger == null && retval != null) {
     RelLookup lookup = new RelLookup(rel);
     lookup.signs = retval;
     lookupCache.intern(lookup);
   }
   return retval;
 }
コード例 #2
0
ファイル: Lexicon.java プロジェクト: kevinkissi/openccg
 /**
  * Returns the lexical signs indexed by the given pred. If the pred is not listed in the lexicon,
  * the tokenizer is consulted to see if it is a special token (date, time, etc.); otherwise, null
  * is returned. Coarticulations are applied for the given rels, if non-null.
  */
 public Collection<Sign> getSignsFromPred(String pred, List<String> coartRels) {
   // check cache (if not doing supertagging)
   if (_supertagger == null) {
     PredLookup lookup = new PredLookup(pred, coartRels);
     PredLookup retLookup = (PredLookup) lookupCache.getInterned(lookup);
     if (retLookup != null) return retLookup.signs;
   }
   // lookup pred
   Collection<Sign> result = getSignsFromPredAndTargetRel(pred, null);
   if (result == null) return null;
   // apply coarts for rels
   if (coartRels != null) applyCoarts(coartRels, result);
   // cache result (if not doing supertagging)
   if (_supertagger == null) {
     PredLookup lookup = new PredLookup(pred, coartRels);
     lookup.signs = result;
     lookupCache.intern(lookup);
   }
   // and return
   return result;
 }