Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8149449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:51:17+00:00 2026-06-06T14:51:17+00:00

I’ve found the class WordnetSynonymParser in org.apache.lucene.analysis.synonym but there aren’t examples of its usage

  • 0

I’ve found the class WordnetSynonymParser in org.apache.lucene.analysis.synonym but there aren’t examples of its usage neither in the API nor in google. Does any one have experience with it?

Thank you!

EDIT: I know that there used to be the class SynExpand, but with version 3.6 it disappeared…

I try:

           try {
                   FileReader rulesReader = new FileReader("wn/wn_s.pl");
               SynonymMap.Builder parser = null;
               parser = new WordnetSynonymParser(true, true, analyzer);
               ((WordnetSynonymParser)parser).add(rulesReader);          
               synonymMap = parser.build();
            } catch (Exception e) {
                            e.printStackTrace();
                            System.exit(1);
            }

But I get the following error:

java.text.ParseException: Invalid synonym rule at line 109
        at org.apache.lucene.analysis.synonym.WordnetSynonymParser.add(WordnetSynonymParser.java:75)
        at pirServer.QueryClassifier.<init>(QueryClassifier.java:77)
        at pirServer.PIRServer.main(PIRServer.java:32)
Caused by: java.lang.IllegalArgumentException: term: course of action analyzed to a token with posinc != 1
        at org.apache.lucene.analysis.synonym.SynonymMap$Builder.analyze(SynonymMap.java:131)
        at org.apache.lucene.analysis.synonym.WordnetSynonymParser.parseSynonym(WordnetSynonymParser.java:92)
        at org.apache.lucene.analysis.synonym.WordnetSynonymParser.add(WordnetSynonymParser.java:67)
        ... 2 more 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:51:18+00:00Added an answer on June 6, 2026 at 2:51 pm

    I am working on a similar thing and just read the documentation – so a relevant caution from the SynonymFilter doc is very fresh:

    “”This token stream cannot properly handle position increments != 1, ie, you should place this filter before filtering out stop words””

    http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/analysis/synonym/SynonymFilter.html

    It’s possible that the analyzer you’re passing (which you fail to describe in your post) to the WordNetSynonymParser does remove stop words (as is the case for most of them) causing:

    java.lang.IllegalArgumentException: term: course of action analyzed to a token with posinc != 1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.