Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

enter image description hereI want to identify most matching sentence using some pattern. That means by using java algorithm I want to create identical value for each sentences.Each sentence when entering to that algorithm can be out some kind of identical value. How can I develop it? What can I refer any web sites do you know? What sort of sites should I look for? Actually I want clarify about when I'm giving as ex: 5 sentence to algorithm that possible to generate some kind of 5 values.Then I compare with those values with previously generated values(I should be store those values in my database) and get the gap between new 5 value and previously stored values.Then I get the distance and I selected most suitable sentence as most lowest gap value.

I'm use those things for my machine translation tool. As an example we think using my ruled based translation model generate 2 sentences. 1. I want eat an apple. 2. I want eat a house. In my corpus we think more sentences include and I store values for sentences in my database. (Value assign part is I don’t know yet) I want to create java algorithm to assign value for each sentence. As an example if we think Sentence 1 value: 250.8 Sentence 2 value : 290.5

Database included values 248, 400,800 Then I got the difference. So we can see here most minimum difference get for 250.8 and most suitable sentence is 1 one.

share|improve this question

closed as off-topic by Bart van Ingen Schenau, gnat, MichaelT, Euphoric, Robert Harvey Mar 17 at 3:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Bart van Ingen Schenau, gnat, MichaelT
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I think this will give you most information you need: programmers.stackexchange.com/questions/49550/… –  thorsten müller Mar 16 at 6:24
    
    
Please, fix your english. It is not clear what you really want. –  Euphoric Mar 16 at 12:22
    
Yep I have not good at English as well.Sorry for that.Again I edited and give some example as well.Dr @Euphoric –  user3149 Mar 16 at 12:50
1  
What I mean is, can you include pseudocode in your question so that we can see what you want? For example, do you want: 1. Which sentence has most similar meaning? 2. Which sentence has most similar characters? –  githubphagocyte Mar 16 at 13:41

1 Answer 1

If you want to create unique value for each and every sentence, then don't even try, because thanks to Pigeonhole principle, you are guaranteed to get collisions and thus the identifiers won't be unique. You could limit the input space accordingly, but in this case the algorithm looses it's purpose.

If you are looking for way to create identifier than might indicate that sentences are be equal, but not guarantee it, then hashing is practically created for this purpose. This the allows you to check if the sentences might be equal, but you still have to run the equality function to guarantee it.

share|improve this answer
    
I use pattern matching technique to my translation tool.In there I have created corpus.That means some big amount of sentences.Firstly I have created candidate sentences by translation English sentence to my language.Then I wanted to select most suitable sentence for that.Therefore I decided to store my corpus sentences according to some kind of java algorithm generated value.Then I'm easy to compare those value with my candidate sentence value and select most suitable one.I haven't clear idea about how to create value or identifiable thing for sentences. –  user3149 Mar 16 at 9:14
    
So I think you are looking for more than just a unique identifier for each sentence. You are looking for the distance from one value to another to indicate distance to the target sentence as well. Can you update the question to reflect this extra requirement? –  Encaitar Mar 16 at 9:21
    
I have edited.Please inform me is there any misunderstand things.Thank you so much for your help. –  user3149 Mar 16 at 9:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.