Re: [Tutor] Find all strings that....
Alexander Etter wrote: On Nov 10, 2011, at 13:52, Francesco Loffredof...@libero.it wrote: Alexander Etter wrote: Hi. My friend gave me a good wake up exercise ... I'd like to try this exercise too; would you mind defining operations more specifically, please? Given a sufficiently broad meaning of operations (e.g. operation = any function call) then any word can be converted into any given word with at most ONE operation. Consider an operation not as a function. A function could easily contain more than two operations. An operation would remove two letters. An operation would add one letter. Etc. Alexander Still, it seems to me too fuzzy a definition. Steven D'Aprano gave us a very thorough one in this thread, but you seem to allow many characters to be deleted in one operation... Anyway, taking for granted the rules contained in the edit distance definition (Thank you, Steven!), I think that finding in a given set S all words that can be converted into some given target with at most N such operations (better: the subset of all words in S with an edit distance from target = N) is a very interesting and challenging task. Thank you (and your friend!) for this exercise, I'll give it a try. Francesco - Nessun virus nel messaggio. Controllato da AVG - www.avg.com Versione: 2012.0.1869 / Database dei virus: 2092/4608 - Data di rilascio: 10/11/2011 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
On Fri, Nov 11, 2011 at 1:21 PM, Francesco Loffredo f...@libero.it wrote: Anyway, taking for granted the rules contained in the edit distance definition (Thank you, Steven!), I think that finding in a given set S all words that can be converted into some given target with at most N such operations (better: the subset of all words in S with an edit distance from target = N) is a very interesting and challenging task. Thank you (and your friend!) for this exercise, I'll give it a try. There are some standard library tools that make this pretty easy. Take a look into difflib if you're interested. As always, there's nothing wrong with doing it yourself so that you understand it better, of course. -- Jerry ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
On Fri, Nov 11, 2011 at 1:38 PM, Jerry Hill malaclyp...@gmail.com wrote: On Fri, Nov 11, 2011 at 1:21 PM, Francesco Loffredo f...@libero.it wrote: Anyway, taking for granted the rules contained in the edit distance definition (Thank you, Steven!), I think that finding in a given set S all words that can be converted into some given target with at most N such operations (better: the subset of all words in S with an edit distance from target = N) is a very interesting and challenging task. Thank you (and your friend!) for this exercise, I'll give it a try. There are some standard library tools that make this pretty easy. Take a look into difflib if you're interested. As always, there's nothing wrong with doing it yourself so that you understand it better, of course. -- Jerry Hi Jerry. I'm checking out difflib. Thanks for the suggestion. Alexander Etter ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
hi, this page contains interesting info about this topic. The algorithms that are discussed are all implemented in Python. http://cs.anu.edu.au/~Peter.Christen/Febrl/febrl-0.3/febrldoc-0.3/node38.html Cheers!! Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ From: Jerry Hill malaclyp...@gmail.com To: tutor@python.org tutor@python.org Sent: Friday, November 11, 2011 7:38 PM Subject: Re: [Tutor] Find all strings that On Fri, Nov 11, 2011 at 1:21 PM, Francesco Loffredo f...@libero.it wrote: Anyway, taking for granted the rules contained in the edit distance definition (Thank you, Steven!), I think that finding in a given set S all words that can be converted into some given target with at most N such operations (better: the subset of all words in S with an edit distance from target = N) is a very interesting and challenging task. Thank you (and your friend!) for this exercise, I'll give it a try. There are some standard library tools that make this pretty easy. Take a look into difflib if you're interested. As always, there's nothing wrong with doing it yourself so that you understand it better, of course. -- Jerry ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Find all strings that....
Hi. My friend gave me a good wake up exercise which I do not want you to solve for me: find all strings which can be converted to alpha with at most two operations, where alpha is some string constant, and a substring of at least length three of alpha must be in the answers. So, my question is: is there a library or .txt dictionary ( not the data type, rather the merriam webster kind ) I can use to test my script on? I'd imagine this library/dictionary to contain thousands of words. Not random words. Thanks for reading, Alexander ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
What about just grabbing a bit text file, such as from Project Gutenberg (sorry for the possibly incorrect spelling)? Or copying the text from a large webpage and pasting it into a text file? On 11/10/11, Alexander Etter rhettna...@gmail.com wrote: Hi. My friend gave me a good wake up exercise which I do not want you to solve for me: find all strings which can be converted to alpha with at most two operations, where alpha is some string constant, and a substring of at least length three of alpha must be in the answers. So, my question is: is there a library or .txt dictionary ( not the data type, rather the merriam webster kind ) I can use to test my script on? I'd imagine this library/dictionary to contain thousands of words. Not random words. Thanks for reading, Alexander ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
If you're on linux or OSX, there's /usr/share/dict/words, which has a few thousand words. Although no plurals, which caught me out once. If you're on windows, it's not a hard file to find. On 10 Nov 2011, at 16:14, Alex Hall wrote: What about just grabbing a bit text file, such as from Project Gutenberg (sorry for the possibly incorrect spelling)? Or copying the text from a large webpage and pasting it into a text file? On 11/10/11, Alexander Etter rhettna...@gmail.com wrote: Hi. My friend gave me a good wake up exercise which I do not want you to solve for me: find all strings which can be converted to alpha with at most two operations, where alpha is some string constant, and a substring of at least length three of alpha must be in the answers. So, my question is: is there a library or .txt dictionary ( not the data type, rather the merriam webster kind ) I can use to test my script on? I'd imagine this library/dictionary to contain thousands of words. Not random words. Thanks for reading, Alexander ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor Rich RoadieRich Lovely There are 10 types of people in the world: Those who know binary, Those who do not, And those who are off by one. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
On 11/10/11, Original Poster Alexander Etter rhettna...@gmail.com wrote: Hi. My friend gave me a good wake up exercise which I do not want you to solve for me: find all strings which can be converted to alpha with at most two operations, where alpha is some string constant, and a substring of at least length three of alpha must be in the answers. So, my question is: is there a library or .txt dictionary ( not the data type, rather the merriam webster kind ) I can use to test my script on? I'd imagine this library/dictionary to contain thousands of words. Not random words. Thanks for reading, Alexander On 10 Nov 2011, at 16:14, Alex Hall wrote: What about just grabbing a bit text file, such as from Project Gutenberg (sorry for the possibly incorrect spelling)? Spelling is correct. No worries. Or copying the text from a large web-page and pasting it into a text file? I will give this a try sometime, thanks for the suggestions. However, as a member of this mailing list, it is my duty to tell you both that you have top posted in reply to the initial question. Top posting is frowned upon. Consider when John Doe finds this thread, sees the subject line, finds it appealing and decides to read it; only to find the first thing he reads is a response from somebody and not the Original post. Now Mr. Doe is scrambling through the file confused about who sent what first and where the original question is. Maybe me typing in the middle of your reply is bad, but it is distinguishable from your email and I am finding it relevant. -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap __ On Thu, Nov 10, 2011 at 11:28 AM, Rich Lovely roadier...@googlemail.comwrote: If you're on linux or OSX, there's /usr/share/dict/words, which has a few thousand words. Although no plurals, which caught me out once. If you're on windows, it's not a hard file to find. Rich RoadieRich Lovely There are 10 types of people in the world: Those who know binary, Those who do not, And those who are off by one. Thanks Rich. I'm on Ubuntu 11.04 and Trisquel. And will make use of that file. It's an interesting collection of words, but certainly missing some of what I would want to see. Like better isn't in there, but Bette is. Anyway at least I can start coding with your suggestion. Thanks. And if you haven't seen above, please don't top post. Au revoir. Alexander E. -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
Alexander Etter wrote: Hi. My friend gave me a good wake up exercise which I do not want you to solve for me: find all strings which can be converted to alpha with at most two operations, where alpha is some string constant, and a substring of at least length three of alpha must be in the answers. I'd like to try this exercise too; would you mind defining operations more specifically, please? Given a sufficiently broad meaning of operations (e.g. operation = any function call) then any word can be converted into any given word with at most ONE operation. So, my question is: is there a library or .txt dictionary ( not the data type, rather the merriam webster kind ) I can use to test my script on? I'd imagine this library/dictionary to contain thousands of words. Not random words. http://www.cs.nmsu.edu/~hfugal/cs167/labs/words.txt Thanks for reading, Alexander More thanks for writing! Francesco - Nessun virus nel messaggio. Controllato da AVG - www.avg.com Versione: 2012.0.1869 / Database dei virus: 2092/4606 - Data di rilascio: 09/11/2011 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
On Nov 10, 2011, at 13:52, Francesco Loffredo f...@libero.it wrote: Alexander Etter wrote: Hi. My friend gave me a good wake up exercise which I do not want you to solve for me: find all strings which can be converted to alpha with at most two operations, where alpha is some string constant, and a substring of at least length three of alpha must be in the answers. I'd like to try this exercise too; would you mind defining operations more specifically, please? Given a sufficiently broad meaning of operations (e.g. operation = any function call) then any word can be converted into any given word with at most ONE operation. Consider an operation not as a function. A function could easily contain more than two operations. An operation would remove two letters. An operation would add one letter. Etc. Alexander So, my question is: is there a library or .txt dictionary ( not the data type, rather the merriam webster kind ) I can use to test my script on? I'd imagine this library/dictionary to contain thousands of words. Not random words. http://www.cs.nmsu.edu/~hfugal/cs167/labs/words.txt Thanks for reading, Alexander More thanks for writing! Francesco - Nessun virus nel messaggio. Controllato da AVG - www.avg.com Versione: 2012.0.1869 / Database dei virus: 2092/4606 - Data di rilascio: 09/11/2011 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Find all strings that....
Alexander Etter wrote: On Nov 10, 2011, at 13:52, Francesco Loffredo f...@libero.it wrote: Alexander Etter wrote: Hi. My friend gave me a good wake up exercise which I do not want you to solve for me: find all strings which can be converted to alpha with at most two operations, where alpha is some string constant, and a substring of at least length three of alpha must be in the answers. I'd like to try this exercise too; would you mind defining operations more specifically, please? Given a sufficiently broad meaning of operations (e.g. operation = any function call) then any word can be converted into any given word with at most ONE operation. Consider an operation not as a function. A function could easily contain more than two operations. An operation would remove two letters. An operation would add one letter. Etc. Sounds to me like you're discussing edit distance, i.e. given only the three permissible edit operations: delete a letter insert a letter replace a letter with another letter what is the least number of edits needed to go from (say) winner to whiner? -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor