Author: rwesten
Date: Tue May 15 09:10:33 2012
New Revision: 1338608

URL: http://svn.apache.org/viewvc?rev=1338608&view=rev
Log:
STANBOL-583: CELI Language Identifiaction Engine

* added assertion that "fr" is detected as language for the test text.

Modified:
    
incubator/stanbol/branches/celi-enhancement-engines/engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java

Modified: 
incubator/stanbol/branches/celi-enhancement-engines/engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/celi-enhancement-engines/engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java?rev=1338608&r1=1338607&r2=1338608&view=diff
==============================================================================
--- 
incubator/stanbol/branches/celi-enhancement-engines/engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java
 (original)
+++ 
incubator/stanbol/branches/celi-enhancement-engines/engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java
 Tue May 15 09:10:33 2012
@@ -85,7 +85,13 @@ public class CeliLanguageIdentifierEnhan
                expectedValues.put(Properties.DC_CREATOR, 
LiteralFactory.getInstance().createTypedLiteral(
                    langIdentifier.getClass().getName()));
                
-               validateLanguageAnnotation(ci.getMetadata(), 
TEXT,expectedValues);
+               PlainLiteral detectedLnaguage = 
validateLanguageAnnotation(ci.getMetadata(), TEXT,expectedValues);
+               //even through this tests do not validate service quality but 
rather
+               //the correct integration of the CELI service as 
EnhancementEngine
+               //we expect the "fr" is detected for the parsed text
+               assertEquals("The detected language for text '"+TEXT+"' MUST BE 
'fr'",
+                   "fr",detectedLnaguage.getLexicalForm());
+
                int entityAnnoNum = 
validateAllEntityAnnotations(ci.getMetadata(), expectedValues);
                assertEquals("No EntityAnnotations are expected",0, 
entityAnnoNum);
                log.info(entityAnnoNum + " EntityAnnotations found ...");
@@ -99,7 +105,7 @@ public class CeliLanguageIdentifierEnhan
        }
 
 
-       private void validateLanguageAnnotation(MGraph g, String 
content,HashMap<UriRef,Resource> expectedValues) {
+       private PlainLiteral validateLanguageAnnotation(MGraph g, String 
content,HashMap<UriRef,Resource> expectedValues) {
                Iterator<Triple> textAnnotationIterator = g.filter(null, 
RDF_TYPE, ENHANCER_TEXTANNOTATION);
                // test if a textAnnotation is present
                assertTrue("The Language Annotation is 
missing!",textAnnotationIterator.hasNext());
@@ -116,6 +122,7 @@ public class CeliLanguageIdentifierEnhan
         assertTrue("The dc:langauge value MUST BE a plain 
literal",languageResource instanceof PlainLiteral);
         assertTrue("The dc:language value MIST BE at least two chars long",
             ((PlainLiteral)languageResource).getLexicalForm().length()>=2);
+        return (PlainLiteral)languageResource;
        }
 // removed: other tests now add a simple triple with 
<{ciUri},dc:langauge,{lang}>
 /**    public static void addEnanchements(ContentItem ci) throws IOException, 
ConfigurationException, EngineException {


Reply via email to