private void ReadHeadRules(string file) { #if DNF using (var headRulesStreamReader = new StreamReader(file, System.Text.Encoding.UTF7)) #else using (var stream = new FileStream(file, FileMode.OpenOrCreate)) using (var headRulesStreamReader = new StreamReader(stream, System.Text.Encoding.UTF7)) #endif { string line = headRulesStreamReader.ReadLine(); mHeadRules = new Dictionary <string, HeadRule>(30); while (line != null) { var tokenizer = new Util.StringTokenizer(line); string number = tokenizer.NextToken(); string type = tokenizer.NextToken(); string direction = tokenizer.NextToken(); var tags = new string[int.Parse(number, System.Globalization.CultureInfo.InvariantCulture)]; int currentTag = 0; string tag = tokenizer.NextToken(); while (tag != null) { tags[currentTag] = tag; currentTag++; tag = tokenizer.NextToken(); } mHeadRules[type] = new HeadRule((direction == "1"), tags); line = headRulesStreamReader.ReadLine(); } } }
private void initAcronyms(string name) { //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'" _acroMap = new Hashtable(15000); try { StreamReader str; //if (MaxentResolver.loadAsResource()) //{ //UPGRADE_TODO: The differences in the expected value of parameters for constructor 'java.io.BufferedReader.BufferedReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'" //UPGRADE_WARNING: At least one expression was used more than once in the target code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1181'" //UPGRADE_ISSUE: Method 'java.lang.Class.getResourceAsStream' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetResourceAsStream_javalangString'" //str = new System.IO.StreamReader(new System.IO.StreamReader(this.GetType().getResourceAsStream(name), System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(this.GetType().getResourceAsStream(name), System.Text.Encoding.Default).CurrentEncoding); //} //else //{ //UPGRADE_TODO: The differences in the expected value of parameters for constructor 'java.io.BufferedReader.BufferedReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'" //UPGRADE_WARNING: At least one expression was used more than once in the target code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1181'" //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" #if DNF str = new StreamReader(new StreamReader(name, Encoding.Default).BaseStream, new StreamReader(name, Encoding.Default).CurrentEncoding); #else str = new StreamReader( new StreamReader(new FileStream(name, FileMode.OpenOrCreate), Encoding.GetEncoding(0)).BaseStream, new StreamReader(new FileStream(name, FileMode.OpenOrCreate), Encoding.GetEncoding(0)).CurrentEncoding); #endif //} string line; while (null != (line = str.ReadLine())) { var st = new Util.StringTokenizer(line, "\t"); string acro = st.NextToken(); string full = st.NextToken(); var exSet = (Util.Set <string>)_acroMap[acro]; if (exSet == null) { //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" exSet = new Util.HashSet <string>(); _acroMap[acro] = exSet; } exSet.Add(full); exSet = (Util.Set <string>)_acroMap[full]; if (exSet == null) { //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" exSet = new Util.HashSet <string>(); _acroMap[full] = exSet; } exSet.Add(acro); } } catch (IOException e) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.ToString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" Console.Error.WriteLine("ProperNounResolver.initAcronyms: Acronym Database not found: " + e); } }
public static Tuple <List <string>, List <string> > ConvertAnnotatedString(string input) { var tokens = new List <string>(); var outcomes = new List <string>(); var tokenizer = new Util.StringTokenizer(input); string token = tokenizer.NextToken(); while (token != null) { Tuple <string, string> linePair = Split(token); tokens.Add(linePair.Item1); outcomes.Add(linePair.Item2); token = tokenizer.NextToken(); } return(new Tuple <List <string>, List <string> >(tokens, outcomes)); }
public static Util.Pair <ArrayList, ArrayList> ConvertAnnotatedString(string input) { ArrayList tokens = new ArrayList(); ArrayList outcomes = new ArrayList(); Util.StringTokenizer tokenizer = new Util.StringTokenizer(input); string token = tokenizer.NextToken(); while (token != null) { Util.Pair <string, string> linePair = Split(token); tokens.Add(linePair.FirstValue); outcomes.Add(linePair.SecondValue); token = tokenizer.NextToken(); } return(new Util.Pair <ArrayList, ArrayList>(tokens, outcomes)); }
private void initAcronyms(string name) { //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'" acroMap = new System.Collections.Hashtable(15000); try { System.IO.StreamReader str; //if (MaxentResolver.loadAsResource()) //{ //UPGRADE_TODO: The differences in the expected value of parameters for constructor 'java.io.BufferedReader.BufferedReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'" //UPGRADE_WARNING: At least one expression was used more than once in the target code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1181'" //UPGRADE_ISSUE: Method 'java.lang.Class.getResourceAsStream' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetResourceAsStream_javalangString'" //str = new System.IO.StreamReader(new System.IO.StreamReader(this.GetType().getResourceAsStream(name), System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(this.GetType().getResourceAsStream(name), System.Text.Encoding.Default).CurrentEncoding); //} //else //{ //UPGRADE_TODO: The differences in the expected value of parameters for constructor 'java.io.BufferedReader.BufferedReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'" //UPGRADE_WARNING: At least one expression was used more than once in the target code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1181'" //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" str = new System.IO.StreamReader(new System.IO.StreamReader(name, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(name, System.Text.Encoding.Default).CurrentEncoding); //} //System.err.println("Reading acronyms database: " + file + " "); string line; while (null != (line = str.ReadLine())) { Util.StringTokenizer st = new Util.StringTokenizer(line, "\t"); string acro = st.NextToken(); string full = st.NextToken(); Util.Set<string> exSet = (Util.Set<string>) acroMap[acro]; if (exSet == null) { //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" exSet = new Util.HashSet<string>(); acroMap[acro] = exSet; } exSet.Add(full); exSet = (Util.Set<string>) acroMap[full]; if (exSet == null) { //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" exSet = new Util.HashSet<string>(); acroMap[full] = exSet; } exSet.Add(acro); } } catch (System.IO.IOException e) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Console.Error.WriteLine("ProperNounResolver.initAcronyms: Acronym Database not found: " + e); } }
private void ReadHeadRules(string file) { using (StreamReader headRulesStreamReader = new StreamReader(file, System.Text.Encoding.UTF7)) { string line = headRulesStreamReader.ReadLine(); mHeadRules = new Dictionary<string, HeadRule>(30); while (line != null) { Util.StringTokenizer tokenizer = new Util.StringTokenizer(line); string number = tokenizer.NextToken(); string type = tokenizer.NextToken(); string direction = tokenizer.NextToken(); string[] tags = new string[int.Parse(number, System.Globalization.CultureInfo.InvariantCulture)]; int currentTag = 0; string tag = tokenizer.NextToken(); while (tag != null) { tags[currentTag] = tag; currentTag++; tag = tokenizer.NextToken(); } mHeadRules[type] = new HeadRule((direction == "1"), tags); line = headRulesStreamReader.ReadLine(); } } }
public static Util.Pair<ArrayList, ArrayList> ConvertAnnotatedString(string input) { ArrayList tokens = new ArrayList(); ArrayList outcomes = new ArrayList(); Util.StringTokenizer tokenizer = new Util.StringTokenizer(input); string token = tokenizer.NextToken(); while (token != null) { Util.Pair<string, string> linePair = Split(token); tokens.Add(linePair.FirstValue); outcomes.Add(linePair.SecondValue); token = tokenizer.NextToken(); } return new Util.Pair<ArrayList, ArrayList>(tokens, outcomes); }
public static Tuple<List<string>, List<string>> ConvertAnnotatedString(string input) { var tokens = new List<string>(); var outcomes = new List<string>(); var tokenizer = new Util.StringTokenizer(input); string token = tokenizer.NextToken(); while (token != null) { Tuple<string, string> linePair = Split(token); tokens.Add(linePair.Item1); outcomes.Add(linePair.Item2); token = tokenizer.NextToken(); } return new Tuple<List<string>, List<string>>(tokens, outcomes); }