0

I´m trying to use Mallet for Topic Modelling. So here´s my code:

{
    ArrayList<Pipe> pipeList = new ArrayList<Pipe>();
    // Lowercase everything
    pipeList.add(new CharSequenceLowercase());
    // Unicode letters, underscore, and hashtag
    Pattern pat = Pattern.compile("[\\p{L}_#]+");
    pipeList.add(new CharSequence2TokenSequence(pat));
    // Remove stop words
    pipeList.add( new TokenSequenceRemoveStopwords(new File("C:\\mallet\\stoplists\\en.txt"), "UTF-8", false, false, false) );
    // Convert the token sequence to a feature sequence.
    pipeList.add(new TokenSequence2FeatureSequence());
    return pipeList;
}

If I run the program it says

Exception in thread "main" java.lang.IllegalArgumentException: Trouble reading file C:\mallet\stoplists\en.txt

Could someone please help me solve this problem?

Blackwood
  • 4,504
  • 16
  • 32
  • 41
Amanda
  • 1
  • Hi welcome to SO. Have never used Mallet before, but it seems to me that you have 1 of 3 problems, 1. The file does not exist in the folder specified, 2. The File does exists but is locked and cannot be opened, 3. You way you try to open the file actually creates the file and there is no content – Jaques Aug 24 '18 at 12:17
  • Thank you Jaques. It was the first problem and works now. – Amanda Aug 24 '18 at 12:27

0 Answers0