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 4620430
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:33:34+00:00 2026-05-22T02:33:34+00:00

I wanna make a program automatically tagger the text in a directory. Here’s my

  • 0

I wanna make a program automatically tagger the text in a directory. Here’s my first step.
I made a little change to TaggerDemo.java. But it is not working properly as expected.

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;

import edu.stanford.nlp.ling.HasWord;
import edu.stanford.nlp.ling.Sentence;
import edu.stanford.nlp.ling.TaggedWord;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;

class auto{

  public static void main (String[] args) throws Exception{

    MaxentTagger tagger = new MaxentTagger("models/left3words-wsj-0-18.tagger");
    @SuppressWarnings("unchecked")
    List<List<HasWord>> sentences = tagger.tokenizeText(new BufferedReader(new FileReader(args[0])));
    for (List<HasWord> sentence : sentences) {
      ArrayList<TaggedWord> tSentence = tagger.tagSentence(sentence);
      System.out.println(Sentence.listToString(tSentence, false));
    }
  }

}

This is the error i got.

Loading default properties from trained tagger models/left3words-wsj-0-18.tagger
Reading POS tagger model from models/left3words-wsj-0-18.tagger ... done [2.9 sec].
Exception in thread "main" java.io.FileNotFoundException: sample-input.txt (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at java.io.FileReader.<init>(FileReader.java:41)
    at auto.main(auto.java:17)

Why it says file not found?

When i tried to compile it under terminal, it says edu.stanford.nlp.ling.* can not be imported…

Thanks a lot.

  • 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-05-22T02:33:35+00:00Added an answer on May 22, 2026 at 2:33 am

    It seems that you don’t have the file sample-input.txt in the current directory.

    To see your current directory, use:

    File f = new File(".");
    System.out.println(f.getAbsolutePath());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna make change in css class every 3 loops. In the first three
i've built my first wpf application, nothing fancy, but i wanna make it look
I wanna write a little c++ program using libcurl. It's for a school project
I wanna make a text editor but its different other text editors.It will get
So i have a old game i made, i wanna try make it for
I wanna make a small code block about c #. first think a listbox
i wanna make a program runs in the background and shows an icon in
I wanna make use of the Ternary Operator with an object. if($msg == 'hello'){
I will make upload my application today to my homepage and wanna to have
I wanna stop the reading of my text input file when the word synonyms

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.