How do i use custom stopwords filter in Java Weka Api?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
3












I am using Java Weka-api to build classification model. I can use builtin stopwords filter however, i need to use custom filter for my problem. I do not how to use custom stopwords filter in java wake-api. Thanks in advance for your support.










share|improve this question







New contributor




Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    1
    down vote

    favorite
    3












    I am using Java Weka-api to build classification model. I can use builtin stopwords filter however, i need to use custom filter for my problem. I do not how to use custom stopwords filter in java wake-api. Thanks in advance for your support.










    share|improve this question







    New contributor




    Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite
      3









      up vote
      1
      down vote

      favorite
      3






      3





      I am using Java Weka-api to build classification model. I can use builtin stopwords filter however, i need to use custom filter for my problem. I do not how to use custom stopwords filter in java wake-api. Thanks in advance for your support.










      share|improve this question







      New contributor




      Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am using Java Weka-api to build classification model. I can use builtin stopwords filter however, i need to use custom filter for my problem. I do not how to use custom stopwords filter in java wake-api. Thanks in advance for your support.







      classification java weka






      share|improve this question







      New contributor




      Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 4 hours ago









      Radia Karim

      82




      82




      New contributor




      Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Radia Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          You could add your source codes with question for better understanding. Anyway you try the following code.



          import weka.core.converters.ConverterUtils.DataSource;
          import weka.filters.unsupervised.attribute.StringToWordVector;
          import weka.core.Instances;


          Instances data = DataSource.read(".../document.txt"); //Your document .
          filter.setInputFormat(data);
          StringToWordVector filter = new StringToWordVector();
          filter.setStopwords(new File(".../stopwords.txt")); //stop words file.
          Instances data = Filter.useFilter(data,filter);


          You can also read the following document for better understanding weka-api for Java.
          http://weka.sourceforge.net/doc.stable/






          share|improve this answer








          New contributor




          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • I appreciate your support. Thanks a lot. Your code and the link of the document really help me lot.
            – Radia Karim
            3 hours ago

















          up vote
          1
          down vote













          First of all you have to prepare a text file for your custom stopwords. Then you can use the following code:



          import weka.filters.unsupervised.attribute.StringToWordVector;

          StringToWordVector filter = new StringToWordVector(10000);
          filter.setStopwords(new File(".../stopwords.txt"));


          Hope it will help you.






          share|improve this answer








          New contributor




          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • I appreciate your support.
            – Radia Karim
            3 hours ago










          • I am very new in Java weka-api programming. I do not understand clearly. Anyone please provide me little more elaborate answer. Thanks in advance for your support.
            – Radia Karim
            3 hours ago










          Your Answer





          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "557"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Radia Karim is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f40784%2fhow-do-i-use-custom-stopwords-filter-in-java-weka-api%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          You could add your source codes with question for better understanding. Anyway you try the following code.



          import weka.core.converters.ConverterUtils.DataSource;
          import weka.filters.unsupervised.attribute.StringToWordVector;
          import weka.core.Instances;


          Instances data = DataSource.read(".../document.txt"); //Your document .
          filter.setInputFormat(data);
          StringToWordVector filter = new StringToWordVector();
          filter.setStopwords(new File(".../stopwords.txt")); //stop words file.
          Instances data = Filter.useFilter(data,filter);


          You can also read the following document for better understanding weka-api for Java.
          http://weka.sourceforge.net/doc.stable/






          share|improve this answer








          New contributor




          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • I appreciate your support. Thanks a lot. Your code and the link of the document really help me lot.
            – Radia Karim
            3 hours ago














          up vote
          1
          down vote



          accepted










          You could add your source codes with question for better understanding. Anyway you try the following code.



          import weka.core.converters.ConverterUtils.DataSource;
          import weka.filters.unsupervised.attribute.StringToWordVector;
          import weka.core.Instances;


          Instances data = DataSource.read(".../document.txt"); //Your document .
          filter.setInputFormat(data);
          StringToWordVector filter = new StringToWordVector();
          filter.setStopwords(new File(".../stopwords.txt")); //stop words file.
          Instances data = Filter.useFilter(data,filter);


          You can also read the following document for better understanding weka-api for Java.
          http://weka.sourceforge.net/doc.stable/






          share|improve this answer








          New contributor




          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • I appreciate your support. Thanks a lot. Your code and the link of the document really help me lot.
            – Radia Karim
            3 hours ago












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          You could add your source codes with question for better understanding. Anyway you try the following code.



          import weka.core.converters.ConverterUtils.DataSource;
          import weka.filters.unsupervised.attribute.StringToWordVector;
          import weka.core.Instances;


          Instances data = DataSource.read(".../document.txt"); //Your document .
          filter.setInputFormat(data);
          StringToWordVector filter = new StringToWordVector();
          filter.setStopwords(new File(".../stopwords.txt")); //stop words file.
          Instances data = Filter.useFilter(data,filter);


          You can also read the following document for better understanding weka-api for Java.
          http://weka.sourceforge.net/doc.stable/






          share|improve this answer








          New contributor




          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          You could add your source codes with question for better understanding. Anyway you try the following code.



          import weka.core.converters.ConverterUtils.DataSource;
          import weka.filters.unsupervised.attribute.StringToWordVector;
          import weka.core.Instances;


          Instances data = DataSource.read(".../document.txt"); //Your document .
          filter.setInputFormat(data);
          StringToWordVector filter = new StringToWordVector();
          filter.setStopwords(new File(".../stopwords.txt")); //stop words file.
          Instances data = Filter.useFilter(data,filter);


          You can also read the following document for better understanding weka-api for Java.
          http://weka.sourceforge.net/doc.stable/







          share|improve this answer








          New contributor




          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered 3 hours ago









          Howa Begum

          334




          334




          New contributor




          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Howa Begum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.











          • I appreciate your support. Thanks a lot. Your code and the link of the document really help me lot.
            – Radia Karim
            3 hours ago
















          • I appreciate your support. Thanks a lot. Your code and the link of the document really help me lot.
            – Radia Karim
            3 hours ago















          I appreciate your support. Thanks a lot. Your code and the link of the document really help me lot.
          – Radia Karim
          3 hours ago




          I appreciate your support. Thanks a lot. Your code and the link of the document really help me lot.
          – Radia Karim
          3 hours ago










          up vote
          1
          down vote













          First of all you have to prepare a text file for your custom stopwords. Then you can use the following code:



          import weka.filters.unsupervised.attribute.StringToWordVector;

          StringToWordVector filter = new StringToWordVector(10000);
          filter.setStopwords(new File(".../stopwords.txt"));


          Hope it will help you.






          share|improve this answer








          New contributor




          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • I appreciate your support.
            – Radia Karim
            3 hours ago










          • I am very new in Java weka-api programming. I do not understand clearly. Anyone please provide me little more elaborate answer. Thanks in advance for your support.
            – Radia Karim
            3 hours ago














          up vote
          1
          down vote













          First of all you have to prepare a text file for your custom stopwords. Then you can use the following code:



          import weka.filters.unsupervised.attribute.StringToWordVector;

          StringToWordVector filter = new StringToWordVector(10000);
          filter.setStopwords(new File(".../stopwords.txt"));


          Hope it will help you.






          share|improve this answer








          New contributor




          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • I appreciate your support.
            – Radia Karim
            3 hours ago










          • I am very new in Java weka-api programming. I do not understand clearly. Anyone please provide me little more elaborate answer. Thanks in advance for your support.
            – Radia Karim
            3 hours ago












          up vote
          1
          down vote










          up vote
          1
          down vote









          First of all you have to prepare a text file for your custom stopwords. Then you can use the following code:



          import weka.filters.unsupervised.attribute.StringToWordVector;

          StringToWordVector filter = new StringToWordVector(10000);
          filter.setStopwords(new File(".../stopwords.txt"));


          Hope it will help you.






          share|improve this answer








          New contributor




          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          First of all you have to prepare a text file for your custom stopwords. Then you can use the following code:



          import weka.filters.unsupervised.attribute.StringToWordVector;

          StringToWordVector filter = new StringToWordVector(10000);
          filter.setStopwords(new File(".../stopwords.txt"));


          Hope it will help you.







          share|improve this answer








          New contributor




          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered 3 hours ago









          Rejaul Karim

          486




          486




          New contributor




          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Rejaul Karim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.











          • I appreciate your support.
            – Radia Karim
            3 hours ago










          • I am very new in Java weka-api programming. I do not understand clearly. Anyone please provide me little more elaborate answer. Thanks in advance for your support.
            – Radia Karim
            3 hours ago
















          • I appreciate your support.
            – Radia Karim
            3 hours ago










          • I am very new in Java weka-api programming. I do not understand clearly. Anyone please provide me little more elaborate answer. Thanks in advance for your support.
            – Radia Karim
            3 hours ago















          I appreciate your support.
          – Radia Karim
          3 hours ago




          I appreciate your support.
          – Radia Karim
          3 hours ago












          I am very new in Java weka-api programming. I do not understand clearly. Anyone please provide me little more elaborate answer. Thanks in advance for your support.
          – Radia Karim
          3 hours ago




          I am very new in Java weka-api programming. I do not understand clearly. Anyone please provide me little more elaborate answer. Thanks in advance for your support.
          – Radia Karim
          3 hours ago










          Radia Karim is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          Radia Karim is a new contributor. Be nice, and check out our Code of Conduct.












          Radia Karim is a new contributor. Be nice, and check out our Code of Conduct.











          Radia Karim is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f40784%2fhow-do-i-use-custom-stopwords-filter-in-java-weka-api%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery