/// <summary>For debugging</summary> /// <param name="args"/> public static void Main(string[] args) { if (args.Length != 1) { System.Console.Error.Printf("Usage: java %s file%n", typeof(FrenchMorphoFeatureSpecification).FullName); System.Environment.Exit(-1); } try { BufferedReader br = new BufferedReader(new FileReader(args[0])); MorphoFeatureSpecification mfs = new FrenchMorphoFeatureSpecification(); //Activate all features for debugging mfs.Activate(MorphoFeatureSpecification.MorphoFeatureType.Gen); mfs.Activate(MorphoFeatureSpecification.MorphoFeatureType.Num); mfs.Activate(MorphoFeatureSpecification.MorphoFeatureType.Per); for (string line; (line = br.ReadLine()) != null;) { MorphoFeatures feats = mfs.StrToFeatures(line); System.Console.Out.Printf("%s\t%s%n", line.Trim(), feats.ToString()); } br.Close(); } catch (FileNotFoundException e) { Sharpen.Runtime.PrintStackTrace(e); } catch (IOException e) { Sharpen.Runtime.PrintStackTrace(e); } }
/// <summary>For debugging.</summary> /// <remarks> /// For debugging. Converts a set of long tags (BAMA analyses as in the ATB) to their morpho /// feature specification. The input file should have one long tag per line. /// </remarks> /// <param name="args"/> public static void Main(string[] args) { if (args.Length != 2) { System.Console.Error.Printf("Usage: java %s filename feats%n", typeof(ArabicMorphoFeatureSpecification).FullName); System.Environment.Exit(-1); } MorphoFeatureSpecification fSpec = new ArabicMorphoFeatureSpecification(); string[] feats = args[1].Split(","); foreach (string feat in feats) { MorphoFeatureSpecification.MorphoFeatureType fType = MorphoFeatureSpecification.MorphoFeatureType.ValueOf(feat); fSpec.Activate(fType); } File fName = new File(args[0]); try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fName))); int nLine = 0; for (string line; (line = br.ReadLine()) != null; nLine++) { MorphoFeatures mFeats = fSpec.StrToFeatures(line.Trim()); System.Console.Out.Printf("%s\t%s%n", line.Trim(), mFeats.ToString()); } br.Close(); System.Console.Out.Printf("%nRead %d lines%n", nLine); } catch (FileNotFoundException e) { Sharpen.Runtime.PrintStackTrace(e); } catch (IOException e) { Sharpen.Runtime.PrintStackTrace(e); } }