Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

How can i implement a parser in java program?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was given a project to write a java program that uses a parser to separate a sentence and produce a graph for that sentence? Parser is an application which can be downloaded. Now how can I integrate the parser with java program? What commands I can use?
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Guru Vuyyur wrote:I was given a project to write a java program that uses a parser to separate a sentence and produce a graph for that sentence? Parser is an application which can be downloaded. Now how can I integrate the parser with java program? What commands I can use?


Welcome to CodeRanch!

I didn't understand what is meant by 'produce a graph for that sentence'. However, let us not focus on that for now.

I would like to ask a couple of questions:
1) What is the nature of this utility? Is is a jar, or executable? Which platform?
2) Does it exposes any APIs, or any way to get input and return output?

Unless we don't know answers for those, its not easy to comment on integrating Java code with that utility.

First, we need to understand if it is possible or not, and then we can think of how to do it.

I hope this helps.
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by checking out existing parsers such as JavaCC, Antlr and SableCC.
 
Marshal
Posts: 66158
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again
I presume by a graph you mean a parse tree. If you download any of the parsers which Ulf suggested, you should be able to find documentation telling you about its API.
 
Guru Vuyyur
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i have to develop a project in java that uses a stanford parser to seperate the setences and has to generate a graph that shows the relation between the words in a sentence. for eg: Ohio is located in America output:

output is shown in the image.



the image shows the graph. but the output need not be the same but it has to show relation between the words in any graph form. The graph can be generated using Jgraph,Jung. But initially i have to integrate the parser software into my program. So how can i integrate a pareser??
image.jpg
[Thumbnail for image.jpg]
 
Ulf Dittmer
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's been a week. so I assume you have had an opportunity to check out the parser libaries I mentioned. Do those not fit your requirements? They don't know about relationships between different kinds of words, that's for sure. If that's what you're looking for, then I don't know any soution for that. But you said "Parser is an application which can be downloaded. " - does that mean you already know which parser you should be using?
 
Guru Vuyyur
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stanford parser is used to separate a sentence to words and also tells the nature of word like noun,pronoun,verb etc. and is a file downloadable as Zip,and it has jar files. I need to build the path using the jar files of this parser and then i can use this parser in my program to separate any sentence. After i build the path with jar files, how can i use this parser in program to do its functions. I need the code that makes use of he parser jar files,takes Sentence as input and generates the output ie words and their nature(noun,pronoun,verb) etc.
For eg: Input- " My dog also likes eating Sasuage"
output: My PN
dog NN
likes VRB etc
 
Ulf Dittmer
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you don't need a parser, because you already know which one you need to use, and have that available. If that's correct, then what exactly is your question? That "Stanford parser" you mention seems a pretty specialized piece of software, that probably very few people know. My guess would be that wherever you got it from is a good place too look for documentation and example code.
 
I'm full of tinier men! And a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!