Skip to content

Conversation

Einsteinnnnn
Copy link

Cause:

The test fails when running the testTagString2() of CWSTaggerTest.java. After analyzing and testing, I found that it was this line of code that was at fault:
assertTrue(s.startsWith("中文 分词 "));
This is caused by the actual result obtained from s being different from the assertTrue parameter. This was fixed by changing the assertTrue parameter to the actual value.

Steps to Reproduce:

First, download all the required models from the GitHub page the author mentioned
Then run mvn install fnlp-core -am -DskipTests, this would download all the required dependency, and build the environment. So fall all build should success
Then run mvn -pl fnlp-core test -Dtest=org.fnlp.nlp.cn.tag.CWSTaggerTest, this is to do the test. At this time a failure should be expected.
Part of the error message:

java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertTrue(Assert.java:52)
	at org.fnlp.nlp.cn.tag.CWSTaggerTest.testTagString2(CWSTaggerTest.java:65)

Proposed Solution:

After analyzing, I found that all the function calls are working without any problem, so all the other tests except testTagString2() are able to pass without any problem. Then when looking at the assertTrue parameter, I realized that there is a difference between the value here and the value I actually get. This was resolved by changing s.startsWith to s.equals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant