// static methods // TODO: For additional keys, read map of name to Class from file??? public static Type LookupAnnotationKey(Env env, string name) { if (env != null) { object obj = env.Get(name); if (obj != null) { if (obj is Type) { return((Type)obj); } else { if (obj is IValue) { obj = ((IValue)obj).Get(); if (obj is Type) { return((Type)obj); } } } } } return(AnnotationLookup.ToCoreKey(name)); }
public CoNLLOutputter(string keys) { if (keys == null) { keys = DefaultKeys; } string[] keyArray = keys.Split(" *, *"); IList <Type> keyList = new List <Type>(); foreach (string key in keyArray) { keyList.Add(AnnotationLookup.ToCoreKey(key)); } keysToPrint = keyList; }
public static Type LookupAnnotationKey(Edu.Stanford.Nlp.Semgraph.Semgrex.Env env, string name) { if (env != null) { object obj = env.Get(name); if (obj != null) { if (obj is Type) { return((Type)obj); } } } // else if (obj instanceof Value) { // obj = ((Value) obj).get(); // if (obj instanceof Class) { // return (Class) obj; // } // } Type coreKeyClass = AnnotationLookup.ToCoreKey(name); if (coreKeyClass != null) { return(coreKeyClass); } else { try { Type clazz = Sharpen.Runtime.GetType(name); return(clazz); } catch (TypeLoadException) { return(null); } } }