public virtual List <string> GetInflVars(string separator) { List <string> inflVars = new List <string>(); if (lexRecordObjs_ != null) { for (int i = 0; i < lexRecordObjs_.Count; i++) { LexRecord temp = (LexRecord)lexRecordObjs_[i]; List <InflVar> inflValues = temp.GetInflVarsAndAgreements().GetInflValues(); for (int j = 0; j < inflValues.Count; j++) { InflVar inflVar = (InflVar)inflValues[j]; string inflVarDetail = inflVar.GetVar() + separator + inflVar.GetCat() + separator + inflVar.GetInflection() + separator + inflVar.GetEui() + separator + inflVar.GetUnInfl() + separator + inflVar.GetCit() + separator + inflVar.GetType(); inflVars.Add(inflVarDetail); } } } return(inflVars); }
public static void Main(string[] args) { string inFile = "LEXICON"; string outFile = "inflVars.data"; if (args.Length == 2) { inFile = args[0]; outFile = args[1]; } else if (args.Length > 0) { Console.WriteLine("** Usage: java GenerateInflVars <inFile> <outFile>"); Environment.Exit(0); } Console.WriteLine("-- inFile: [" + inFile + "]"); Console.WriteLine("-- outFile: [" + outFile + "]"); try { List <InflVar> inflVars = ToInflVarsApi.GetInflVarsFromTextFile(inFile); InflVarComparator <InflVar> comp = new InflVarComparator(); inflVars.Sort(comp); System.IO.StreamWriter outWriter = Files.newBufferedWriter(Paths.get(outFile, new string[0]), Charset.forName("UTF-8"), new OpenOption[0]); for (int i = 0; i < inflVars.Count; i++) { InflVar inflVar = (InflVar)inflVars[i]; if (inflVar.GetUnique() == true) { string outStr = inflVar.GetVar() + "|" + Category.ToValue(inflVar.GetCat()) + "|" + Inflection.ToValue(inflVar.GetInflection()) + "|" + inflVar.GetEui() + "|" + inflVar.GetUnInfl() + "|" + inflVar.GetCit(); outWriter.Write(outStr); outWriter.WriteLine(); } } outWriter.Close(); } catch (Exception x) { Console.WriteLine("** ERR@GenerateInflVars( ): " + x.ToString()); } }
public static void Main(string[] args) { if ((args.Length == 0) || (args.Length > 2)) { Console.Error.WriteLine("** Usage: java ToJavaObjectFromTextFile <inFile(Text)> <-i>"); Console.Error.WriteLine(""); Console.Error.WriteLine("Options:"); Console.Error.WriteLine(" -i: generate inflection vars"); Environment.Exit(1); } bool inflVarFlag = false; for (int i = 0; i < args.Length; i++) { if (args[i].Equals("-i")) { inflVarFlag = true; break; } } try { List <LexRecord> lexRecords = ToJavaObjApi.ToJavaObjsFromTextFile(args[0]); if (lexRecords.Count <= 0) { Environment.Exit(1); } else { for (int i = 0; i < lexRecords.Count; i++) { LexRecord lexRecord = (LexRecord)lexRecords[i]; Console.Write(lexRecord.GetText()); if (inflVarFlag == true) { Console.WriteLine("----- Inflection Vars -----"); List <InflVar> inflVars = lexRecord.GetInflVarsAndAgreements().GetInflValues(); for (int j = 0; j < inflVars.Count; j++) { InflVar inflVar = (InflVar)inflVars[j]; Console.WriteLine(inflVar.GetVar() + "|" + Category.ToValue(inflVar.GetCat()) + "|" + Inflection.ToValue(inflVar.GetInflection()) + "|" + inflVar.GetEui() + "|" + inflVar.GetUnInfl() + "|" + inflVar.GetCit()); } } } } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } }