[mary-dev] testing a NLP component
fxavier at ircam.fr
fxavier at ircam.fr
Mon May 16 16:32:51 CEST 2011
Success!
Many thanks, it works. However, I wanted to print onto the output the
result, ie the text preprocessed (whole code below). According to the
lines
String output = new String(result.toString());
System.out.println(output);
I should see the result? But what I get is:
marytts.datatypes.MaryData at 725967
Any ideas?
Best,
Florent
public class preprocessFRtest{
/**
* We start the Mary system.
* @throws Exception
*/
@BeforeClass
public static void startMARY() throws Exception {
if (Mary.currentState() == Mary.STATE_OFF) {
Mary.startup();
}
if (!MaryUtils.isLog4jConfigured()) {
BasicConfigurator.configure();
}
}
/**
* This method test the preprocess module by reading the xml document
wildStuff.tokens.
* @input : TOKENS
* @throws Exception
*/
@Test
public void canProcessWildStuff() throws Exception {
// Set up system under test:
MaryModule preprocessor =
ModuleRegistry.getModule(marytts.language.de.Preprocess.class);
MaryData input = new MaryData(MaryDataType.TOKENS, Locale.GERMAN);
input.readFrom(this.getClass().getResourceAsStream("wildStuff.tokens"));
// exercise system under test:
MaryData result = preprocessor.process(input);
//show output
String output = new String(result.toString());
System.out.println(output);
// verify expected result:
assertNotNull(result);
}
}
> excellent, this is progress.
>
> Now you need to define the system property "mary.base". Do the following:
>
> In the Eclipse menu, go to "Run"->"Run Configurations..." and select
> your "preprocessFRtest" target from among the "JUnit" targets on the
> left. Then, go to the "Arguments" tab, and enter into the "VM arguments":
>
> -Dmary.base=/path/to/workspace/OpenMary
>
>
> Apply, and try again.
>
> What this does is, it tells the MARY code where on the file system to
> find its files.
>
> Best,
> Marc
>
>>
>>
>>
>>> Ah, now we can make progress. You are mixing Junit 3 and 4: your tests
>>> are written according to Junit 4 (@Test ...), but your exception is
>>> thrown by Junit 3 classes -- I think it is because you extend TestCase.
>>>
>>> Try changing
>>>
>>> public class preprocessorFRtest extends TestCase {
>>>
>>> to
>>>
>>> public class preprocessorFRtest {
>>>
>>>
>>>
>>> And remove any import statements for junit.framework.... from the top
>>> of
>>> your file.
>>>
>>> Then run the junit runner again.
>>>
>>>
>>> Best,
>>> Marc
>>>
>
> --
> Dr. Marc Schröder, Senior Researcher at DFKI GmbH
> Project leader for DFKI in SSPNet http://sspnet.eu
> Team Leader DFKI TTS Group http://mary.dfki.de
> Editor W3C EmotionML Working Draft http://www.w3.org/TR/emotionml/
> Portal Editor http://emotion-research.net
>
> Homepage: http://www.dfki.de/~schroed
> Email: marc.schroeder at dfki.de
> Phone: +49-681-85775-5303
> Postal address: DFKI GmbH, Campus D3_2, Stuhlsatzenhausweg 3, D-66123
> Saarbrücken, Germany
> --
> Official DFKI coordinates:
> Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
> Trippstadter Strasse 122, D-67663 Kaiserslautern, Germany
> Geschaeftsfuehrung:
> Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
> Dr. Walter Olthoff
> Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
> Amtsgericht Kaiserslautern, HRB 2313
>
>
More information about the Mary-dev
mailing list