Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This AttributeSource does not have the attribute: TermAttribute #102

Open
GoogleCodeExporter opened this issue Mar 14, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

I included PaodingTokeizr into classifier4J to make it supportive for Chinese, 
following this: 
http://www.cnblogs.com/chenying99/archive/2013/07/12/3185379.html

And I got this exception: java.lang.IllegalArgumentException: 

This AttributeSource does not have the attribute 
'org.apache.lucene.analysis.tokenattributes.TermAttribute'.
at org.apache.lucene.util.AttributeSource.getAttribute(AttributeSource.java:265)
    at net.sf.classifier4J.PaodingTokenizer.tokenize(PaodingTokenizer.java:24)
    at net.sf.classifier4J.Utilities.getWordFrequency(Utilities.java:102)
    at net.sf.classifier4J.Utilities.getWordFrequency(Utilities.java:82)
    at net.sf.classifier4J.Utilities.getWordFrequency(Utilities.java:77)
    at net.sf.classifier4J.summariser.SimpleSummariser.summarise(SimpleSummariser.java:82)

My version: paoding-analysis-2.0.4-beta, lucene-core-3.0.0

I don't know what attribute the exception refers. Is this about the .properties 
files?

Original issue reported on code.google.com by helenf...@gmail.com on 23 Sep 2013 at 1:02

@GoogleCodeExporter
Copy link
Author

已解决。我看的那个资源写错了一行代码。
这句是错的:TermAttribute termAtt = 
(TermAttribute)ts.getAttribute(TermAttribute.class);
这句是对的:TermAttribute termAtt = 
(TermAttribute)ts.addAttribute(TermAttribute.class);        

Original comment by helenf...@gmail.com on 24 Sep 2013 at 7:16

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

No branches or pull requests

1 participant