コード例 #1
0
        /// <summary>
        /// Basic test ensuring that tokenStream works correctly.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testReusableTokenStream() throws Exception
        public virtual void testReusableTokenStream()
        {
            Analyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT);

            assertAnalyzesTo(a, "خورده مي شده بوده باشد", new string[] { "خورده" });
            assertAnalyzesTo(a, "برگ‌ها", new string[] { "برگ" });
        }
コード例 #2
0
        /// <summary>
        /// This test shows how the combination of tokenization (breaking on zero-width
        /// non-joiner or space) and stopwords creates a light-stemming effect for
        /// nouns, removing the plural -ha.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testBehaviorNouns() throws Exception
        public virtual void testBehaviorNouns()
        {
            Analyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT);

            assertAnalyzesTo(a, "برگ ها", new string[] { "برگ" });
            assertAnalyzesTo(a, "برگ‌ها", new string[] { "برگ" });
        }
コード例 #3
0
        /// <summary>
        /// This test shows how the combination of tokenization (breaking on zero-width
        /// non-joiner), normalization (such as treating arabic YEH and farsi YEH the
        /// same), and stopwords creates a light-stemming effect for verbs.
        /// 
        /// These verb forms are from http://en.wikipedia.org/wiki/Persian_grammar
        /// </summary>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testBehaviorVerbs() throws Exception
        public virtual void testBehaviorVerbs()
        {
            Analyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT);
            // active present indicative
            assertAnalyzesTo(a, "می‌خورد", new string[] {"خورد"});
            // active preterite indicative
            assertAnalyzesTo(a, "خورد", new string[] {"خورد"});
            // active imperfective preterite indicative
            assertAnalyzesTo(a, "می‌خورد", new string[] {"خورد"});
            // active future indicative
            assertAnalyzesTo(a, "خواهد خورد", new string[] {"خورد"});
            // active present progressive indicative
            assertAnalyzesTo(a, "دارد می‌خورد", new string[] {"خورد"});
            // active preterite progressive indicative
            assertAnalyzesTo(a, "داشت می‌خورد", new string[] {"خورد"});

            // active perfect indicative
            assertAnalyzesTo(a, "خورده‌است", new string[] {"خورده"});
            // active imperfective perfect indicative
            assertAnalyzesTo(a, "می‌خورده‌است", new string[] {"خورده"});
            // active pluperfect indicative
            assertAnalyzesTo(a, "خورده بود", new string[] {"خورده"});
            // active imperfective pluperfect indicative
            assertAnalyzesTo(a, "می‌خورده بود", new string[] {"خورده"});
            // active preterite subjunctive
            assertAnalyzesTo(a, "خورده باشد", new string[] {"خورده"});
            // active imperfective preterite subjunctive
            assertAnalyzesTo(a, "می‌خورده باشد", new string[] {"خورده"});
            // active pluperfect subjunctive
            assertAnalyzesTo(a, "خورده بوده باشد", new string[] {"خورده"});
            // active imperfective pluperfect subjunctive
            assertAnalyzesTo(a, "می‌خورده بوده باشد", new string[] {"خورده"});
            // passive present indicative
            assertAnalyzesTo(a, "خورده می‌شود", new string[] {"خورده"});
            // passive preterite indicative
            assertAnalyzesTo(a, "خورده شد", new string[] {"خورده"});
            // passive imperfective preterite indicative
            assertAnalyzesTo(a, "خورده می‌شد", new string[] {"خورده"});
            // passive perfect indicative
            assertAnalyzesTo(a, "خورده شده‌است", new string[] {"خورده"});
            // passive imperfective perfect indicative
            assertAnalyzesTo(a, "خورده می‌شده‌است", new string[] {"خورده"});
            // passive pluperfect indicative
            assertAnalyzesTo(a, "خورده شده بود", new string[] {"خورده"});
            // passive imperfective pluperfect indicative
            assertAnalyzesTo(a, "خورده می‌شده بود", new string[] {"خورده"});
            // passive future indicative
            assertAnalyzesTo(a, "خورده خواهد شد", new string[] {"خورده"});
            // passive present progressive indicative
            assertAnalyzesTo(a, "دارد خورده می‌شود", new string[] {"خورده"});
            // passive preterite progressive indicative
            assertAnalyzesTo(a, "داشت خورده می‌شد", new string[] {"خورده"});
            // passive present subjunctive
            assertAnalyzesTo(a, "خورده شود", new string[] {"خورده"});
            // passive preterite subjunctive
            assertAnalyzesTo(a, "خورده شده باشد", new string[] {"خورده"});
            // passive imperfective preterite subjunctive
            assertAnalyzesTo(a, "خورده می‌شده باشد", new string[] {"خورده"});
            // passive pluperfect subjunctive
            assertAnalyzesTo(a, "خورده شده بوده باشد", new string[] {"خورده"});
            // passive imperfective pluperfect subjunctive
            assertAnalyzesTo(a, "خورده می‌شده بوده باشد", new string[] {"خورده"});

            // active present subjunctive
            assertAnalyzesTo(a, "بخورد", new string[] {"بخورد"});
        }
コード例 #4
0
 /// <summary>
 /// This test shows how the combination of tokenization (breaking on zero-width
 /// non-joiner or space) and stopwords creates a light-stemming effect for
 /// nouns, removing the plural -ha.
 /// </summary>
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public void testBehaviorNouns() throws Exception
 public virtual void testBehaviorNouns()
 {
     Analyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT);
     assertAnalyzesTo(a, "برگ ها", new string[] {"برگ"});
     assertAnalyzesTo(a, "برگ‌ها", new string[] {"برگ"});
 }
コード例 #5
0
 /// <summary>
 /// Test showing that non-persian text is treated very much like SimpleAnalyzer
 /// (lowercased, etc)
 /// </summary>
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public void testBehaviorNonPersian() throws Exception
 public virtual void testBehaviorNonPersian()
 {
     Analyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT);
     assertAnalyzesTo(a, "English test.", new string[] {"english", "test"});
 }
コード例 #6
0
 /// <summary>
 /// Basic test ensuring that tokenStream works correctly.
 /// </summary>
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public void testReusableTokenStream() throws Exception
 public virtual void testReusableTokenStream()
 {
     Analyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT);
     assertAnalyzesTo(a, "خورده مي شده بوده باشد", new string[] {"خورده"});
     assertAnalyzesTo(a, "برگ‌ها", new string[] {"برگ"});
 }
コード例 #7
0
 /// <summary>
 /// Test that custom stopwords work, and are not case-sensitive.
 /// </summary>
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public void testCustomStopwords() throws Exception
 public virtual void testCustomStopwords()
 {
     PersianAnalyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT, new CharArraySet(TEST_VERSION_CURRENT, asSet("the", "and", "a"), false));
     assertAnalyzesTo(a, "The quick brown fox.", new string[] {"quick", "brown", "fox"});
 }
コード例 #8
0
        /// <summary>
        /// This test shows how the combination of tokenization (breaking on zero-width
        /// non-joiner), normalization (such as treating arabic YEH and farsi YEH the
        /// same), and stopwords creates a light-stemming effect for verbs.
        ///
        /// These verb forms are from http://en.wikipedia.org/wiki/Persian_grammar
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testBehaviorVerbs() throws Exception
        public virtual void testBehaviorVerbs()
        {
            Analyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT);

            // active present indicative
            assertAnalyzesTo(a, "می‌خورد", new string[] { "خورد" });
            // active preterite indicative
            assertAnalyzesTo(a, "خورد", new string[] { "خورد" });
            // active imperfective preterite indicative
            assertAnalyzesTo(a, "می‌خورد", new string[] { "خورد" });
            // active future indicative
            assertAnalyzesTo(a, "خواهد خورد", new string[] { "خورد" });
            // active present progressive indicative
            assertAnalyzesTo(a, "دارد می‌خورد", new string[] { "خورد" });
            // active preterite progressive indicative
            assertAnalyzesTo(a, "داشت می‌خورد", new string[] { "خورد" });

            // active perfect indicative
            assertAnalyzesTo(a, "خورده‌است", new string[] { "خورده" });
            // active imperfective perfect indicative
            assertAnalyzesTo(a, "می‌خورده‌است", new string[] { "خورده" });
            // active pluperfect indicative
            assertAnalyzesTo(a, "خورده بود", new string[] { "خورده" });
            // active imperfective pluperfect indicative
            assertAnalyzesTo(a, "می‌خورده بود", new string[] { "خورده" });
            // active preterite subjunctive
            assertAnalyzesTo(a, "خورده باشد", new string[] { "خورده" });
            // active imperfective preterite subjunctive
            assertAnalyzesTo(a, "می‌خورده باشد", new string[] { "خورده" });
            // active pluperfect subjunctive
            assertAnalyzesTo(a, "خورده بوده باشد", new string[] { "خورده" });
            // active imperfective pluperfect subjunctive
            assertAnalyzesTo(a, "می‌خورده بوده باشد", new string[] { "خورده" });
            // passive present indicative
            assertAnalyzesTo(a, "خورده می‌شود", new string[] { "خورده" });
            // passive preterite indicative
            assertAnalyzesTo(a, "خورده شد", new string[] { "خورده" });
            // passive imperfective preterite indicative
            assertAnalyzesTo(a, "خورده می‌شد", new string[] { "خورده" });
            // passive perfect indicative
            assertAnalyzesTo(a, "خورده شده‌است", new string[] { "خورده" });
            // passive imperfective perfect indicative
            assertAnalyzesTo(a, "خورده می‌شده‌است", new string[] { "خورده" });
            // passive pluperfect indicative
            assertAnalyzesTo(a, "خورده شده بود", new string[] { "خورده" });
            // passive imperfective pluperfect indicative
            assertAnalyzesTo(a, "خورده می‌شده بود", new string[] { "خورده" });
            // passive future indicative
            assertAnalyzesTo(a, "خورده خواهد شد", new string[] { "خورده" });
            // passive present progressive indicative
            assertAnalyzesTo(a, "دارد خورده می‌شود", new string[] { "خورده" });
            // passive preterite progressive indicative
            assertAnalyzesTo(a, "داشت خورده می‌شد", new string[] { "خورده" });
            // passive present subjunctive
            assertAnalyzesTo(a, "خورده شود", new string[] { "خورده" });
            // passive preterite subjunctive
            assertAnalyzesTo(a, "خورده شده باشد", new string[] { "خورده" });
            // passive imperfective preterite subjunctive
            assertAnalyzesTo(a, "خورده می‌شده باشد", new string[] { "خورده" });
            // passive pluperfect subjunctive
            assertAnalyzesTo(a, "خورده شده بوده باشد", new string[] { "خورده" });
            // passive imperfective pluperfect subjunctive
            assertAnalyzesTo(a, "خورده می‌شده بوده باشد", new string[] { "خورده" });

            // active present subjunctive
            assertAnalyzesTo(a, "بخورد", new string[] { "بخورد" });
        }
コード例 #9
0
        /// <summary>
        /// Test that custom stopwords work, and are not case-sensitive.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testCustomStopwords() throws Exception
        public virtual void testCustomStopwords()
        {
            PersianAnalyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT, new CharArraySet(TEST_VERSION_CURRENT, asSet("the", "and", "a"), false));

            assertAnalyzesTo(a, "The quick brown fox.", new string[] { "quick", "brown", "fox" });
        }
コード例 #10
0
        /// <summary>
        /// Test showing that non-persian text is treated very much like SimpleAnalyzer
        /// (lowercased, etc)
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testBehaviorNonPersian() throws Exception
        public virtual void testBehaviorNonPersian()
        {
            Analyzer a = new PersianAnalyzer(TEST_VERSION_CURRENT);

            assertAnalyzesTo(a, "English test.", new string[] { "english", "test" });
        }