Find the answer to your Linux question:
Results 1 to 4 of 4
I was typing on MS Word 2003 and decided to make a Find/Replace program of my own (in Linux, as I don't know the commands for taking a file's contents ...
  1. #1
    Linux User
    Join Date
    Aug 2005
    Posts
    341

    Self programming practice C++ - Find/Replace program

    I was typing on MS Word 2003 and decided to make a Find/Replace program of my own (in Linux, as I don't know the commands for taking a file's contents as program input on Windows). Just for kicks, ya know?

    So I was checking out what MS Word has in the Find/Replace box (I'm booted into Windows atm due to a Windows-only program I want to run) and it had a "Find All Word Forms" checkbox. So I figured that'd be a cool feature to have. I tried it out, and at least for come, coming, comes, and came, it correctly replaced it with go, going, goes, and went. So I thought this was pretty cool. Now I'm wondering how the hell it did that, and figure it must use some sort of database or something to cross-reference the words.

    So if that were the case, that there is such a database of sorts, I decided to look on the internet for a similar database. I must suck at searching, cause I didn't find much (although I didn't spend much time searching, just a few minutes). I checked out what might be in the C:\ drive for files in the Office directory, but didn't find anything.

    My understanding of how programs are put together is pretty vague, so for all I know, it could be in a .dll or one of the other files with weird extensions, or I don't know where. But I'm not really in the know as to how to reverse engineer programs (especially big ones like Word) so I'm not about to learn how to do so just to find a possibly non-existant word database.

    So the big question is, does anyone know where I can find something to help me do this whole "word forms" functionality? Like a huge database of root words and their various forms? Does OpenOffice perhaps have this functionality (off the top of my head I can't remember) and have source for it?

    - GPAC

  2. #2
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    So if I get this right, you just told Word to find all forms of the verb 'come' and replace it with 'go'.

    A sentence like "I came yesterday" would turn to "I went yesterday". That's pretty cool. No, OOo doesn't do that. Not in my language anyway. But a database for that functionality could of course be made. It's a LOT of work though, and the filter to search and replace needs to be very precise.

    I don't think building this functionality is an exercise. Rather it would be your magnum opus..

    Oh! There are of course lists of irregular verbs. That's a good start.

    How does the Word Find/Replace Form handle more exotic English verbs like 'pwn' or 'I scripted this in...' and stuff like that? Can it handle any verb?

  3. #3
    Linux User
    Join Date
    Oct 2004
    Location
    /dev/random
    Posts
    404
    I think it should be possible to use a dictionary API (like what GNU aspell does) to query all forms of a word/verb.

    You can check out the sources of aspell.
    The Unforgiven
    Registered Linux User #358564

  4. #4
    Linux User
    Join Date
    Aug 2005
    Posts
    341
    In reply to the first post, I Word has a little message saying that the Find/Replace doesn't work all that well with the "all word forms" checkbox checked, which is why I used simple words like come. Off the top of my head, I can't really think of some weird find word and replace word that might trip up the thing.

    As for aspell, I'll check it out. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...