Esempio n. 1
0
        public void TestParse()
        {
            var jParser = CreateJavaParser(modelFile);
            var sParser = CreateSharpParser(modelFile);

            var sentences = new[] {
                "Let all your things have their places; let each part of your business have its time.",
                "It has become appallingly obvious that our technology has exceeded our humanity.",
                "The real problem is not whether machines think but whether men do.",
                "The worst form of inequality is to try to make unequal things equal.",
                "People won't have time for you if you are always angry or complaining.",
                "To keep the body in good health is a duty... otherwise we shall not be able to keep our mind strong and clear.",
                "You, yourself, as much as anybody in the entire universe, deserve your love and affection."
            };


            foreach (var sentence in sentences)
            {
                var jParses = opennlp.tools.cmdline.parser.ParserTool.parseLine(sentence, jParser, 1);
                var sParses = ParserTool.ParseLine(sentence, sParser, 1);

                var jsb = new java.lang.StringBuffer();

                jParses[0].show(jsb);

                Assert.That(sParses[0].ToString(), Is.EqualTo(jsb.ToString()));
            }
        }
Esempio n. 2
0
        public string FormatNumber(double number, string pattern)
        {
            java.text.DecimalFormat frm = new java.text.DecimalFormat("", javaFormat);

            frm.applyLocalizedPattern(pattern);

            //TODO: the next 4 string could be replaced by just
            //return frm.format (number);
            //I don't want to do that before release
            java.lang.StringBuffer  buffer = new java.lang.StringBuffer();
            java.text.FieldPosition fld    = new java.text.FieldPosition(0);

            frm.format(number, buffer, fld);
            return(buffer.ToString());
        }
		public string FormatNumber (double number, string pattern)
		{
			java.text.DecimalFormat frm = new java.text.DecimalFormat("", javaFormat);

			frm.applyLocalizedPattern (pattern);

			//TODO: the next 4 string could be replaced by just 
			//return frm.format (number);
			//I don't want to do that before release
			java.lang.StringBuffer buffer= new java.lang.StringBuffer ();
			java.text.FieldPosition fld = new java.text.FieldPosition (0);

			frm.format (number, buffer, fld);
			return buffer.ToString();
		}
Esempio n. 4
0
 public override string ToString()
 {
     return(buf.ToString());
 }