[comp.sys.amiga.programmer] How to make a mulit-lingual dictionary?

Rasiel <PYC118@uriacc.uri.edu> (04/24/91)

I would like to know how to go about making a program which would translate
an english word to any of several languages. I imagine this could be done
even in BASIC with endless DATA statements. I have no programming experience
but I imagine it would look something like:

    10 print"What word to translate";inputA$
    20 print"What language to translate to"inputB$
    30 ifA$="sneeze" then goto 100
    40 ifB$="spanish" then goto 150
    50 ifB$="chinese" then goto 200
    60 end
    100 data spanish,chinese,A$+B$
    150 data spanish,estornudo
    200 data chinese, ah-chu

Now I know this is very crude and wouldn't make one bit of sense to the
computer but, like I said, I have no programming exp.

Is there an easy way to do this so that all I'd have to do after setting up the
program skeleton would simply be adding in more data statements? How would
this be done in C? Wait, I don't have a C program- never mind.

If anyone can help me I wouldn't mind spending a few days typing in words from
several different dictionaries. I might even be ambitious enough to try my
hand at a grammatical interpreter; that is, one could type in a whole sentence
and the Amiga could spit out a passable translation if it followed some rules.
For example, in german the verbs would be stuck at the end of a sentence, etc.

I don't know how to deal with foreign characters either but that seems a minor
problem for now. Englidhfont will have to do!!

Rasiel, pyc118@uriacc

peterk@cbmger.UUCP (Peter Kittel GERMANY) (04/24/91)

In article <51684@nigel.ee.udel.edu> PYC118@uriacc.uri.edu (Rasiel) writes:
>I would like to know how to go about making a program which would translate
>an english word to any of several languages. I imagine this could be done
>even in BASIC with endless DATA statements. I have no programming experience
>but I imagine it would look something like:

Let me change your code a little so that it will work:

       print"What word to translate";input A$
       restore English:n=0:e$=A$+"xx"
       while e$<>A$:n=n+1:read e$
          if e$="xxx" then n=-1
          wend
       if n<1 then print "Unknown word":end
      
       print"What language to translate to":input B$
       if B$="german" then restore German
       if B$="french" then restore French
       
       for i=1 to n:read e$:next
       print "English word ";A$;" is ";e$;" in ";B$
       end

       English: 
       data one,two,house,...
       data xxx: REM This must be the closing English entry 
       German:
       data eins,zwei,Haus,...   
       French:
       data un,deux,maison,...
       REM these national DATA's don't need a closing xxx entry

I say, Basic is easy.

-- 
Best regards, Dr. Peter Kittel  // E-Mail to  \\  Only my personal opinions... 
Commodore Frankfurt, Germany  \X/ {uunet|pyramid|rutgers}!cbmvax!cbmger!peterk

frank@morpheus.UUCP (Frank McPherson) (04/25/91)

In article <1154@cbmger.UUCP> peterk@cbmger.UUCP (Peter Kittel GERMANY) writes:
>In article <51684@nigel.ee.udel.edu> PYC118@uriacc.uri.edu (Rasiel) writes:
>>I would like to know how to go about making a program which would translate
>>an english word to any of several languages. I imagine this could be done
>>even in BASIC with endless DATA statements. I have no programming experience
>>but I imagine it would look something like:
>
>Let me change your code a little so that it will work:
>
	<SOME BASIC CODE DELETED>
>
>I say, Basic is easy.
>
>--
>Best regards, Dr. Peter Kittel  // E-Mail to  \\  Only my personal opinions...
>Commodore Frankfurt, Germany  \X/ {uunet|pyramid|rutgers}!cbmvax!cbmger!peterk

--
One thing you may want to consider if you want to just translate words is
using Lisp.  I don't program regularly in it, but I do know that writing a
program which sets up equivalences for words is VERY VERY simple in Lisp.
I do believe there are public domain Lisp interpreters for the Amiga, but
I don't remember the names or locations of any right now.  Try checking the
Fish library.

-- Frank McPherson		 INTERNET : emcphers@fox.cs.vt.edu	--
--				AmigaUUCP : uunet!vtserf!morpheus!frank --

d0micke@dtek.chalmers.se (Mikael Andersson) (04/28/91)

In article <1154@cbmger.UUCP>, peterk@cbmger.UUCP (Peter Kittel GERMANY) writes:
|> In article <51684@nigel.ee.udel.edu> PYC118@uriacc.uri.edu (Rasiel) writes:
|> >I would like to know how to go about making a program which would translate
|> >an english word to any of several languages. I imagine this could be done
|> >even in BASIC with endless DATA statements. I have no programming experience
|> >but I imagine it would look something like:
|> 
|> Let me change your code a little so that it will work:
|> 
|>        print"What word to translate";input A$
|>        restore English:n=0:e$=A$+"xx"
|>        while e$<>A$:n=n+1:read e$
|>           if e$="xxx" then n=-1
|>           wend
|>        if n<1 then print "Unknown word":end
|>       
|>        print"What language to translate to":input B$
|>        if B$="german" then restore German
|>        if B$="french" then restore French
|>        
|>        for i=1 to n:read e$:next
|>        print "English word ";A$;" is ";e$;" in ";B$
|>        end
|> 
|>        English: 
|>        data one,two,house,...
|>        data xxx: REM This must be the closing English entry 
|>        German:
|>        data eins,zwei,Haus,...   
|>        French:
|>        data un,deux,maison,...
|>        REM these national DATA's don't need a closing xxx entry
|> 
|> I say, Basic is easy.
|> 
|> -- 
|> Best regards, Dr. Peter Kittel  // E-Mail to  \\  Only my personal opinions... 
|> Commodore Frankfurt, Germany  \X/ {uunet|pyramid|rutgers}!cbmvax!cbmger!peterk

 This works fine, but what if the poor guy wants a 10000 word dictionary and
 is using AmigaBASIC ? ?
 He is bound to get gray hairs - that's for sure.
 

 /Mikael


-- 
* At school:         Holidays:        *
* Mikael Andersson   Mikael Andersson * The best solution to a problem is  
* Welandergatan 28   Murarv{gen 62    * always neat, simple and wrong.
* 416 56 G|teborg    902 51 Ume}      *
 
--
* At school:         Holidays:        *
* Mikael Andersson   Mikael Andersson * The best solution to a problem is  
* Welandergatan 28   Murarv{gen 62    * always neat, simple and wrong.
* 416 56 G|teborg    902 51 Ume}      *

peterk@cbmger.UUCP (Peter Kittel GERMANY) (04/30/91)

In article <frank.4538@morpheus.UUCP> frank@morpheus.UUCP (Frank McPherson) writes:
>In article <1154@cbmger.UUCP> peterk@cbmger.UUCP (Peter Kittel GERMANY) writes:
>>In article <51684@nigel.ee.udel.edu> PYC118@uriacc.uri.edu (Rasiel) writes:
>>>I would like to know how to go about making a program which would translate
>>>an english word to any of several languages.
>>
>	<SOME BASIC CODE DELETED>
>>
>>I say, Basic is easy.
>
>One thing you may want to consider if you want to just translate words is
>using Lisp.

Oh, you take the BIG gun... :-)

Now that some days have passed, I can even propose a *much* simpler idea:
Why not simply use plain AmigaDOS? If you don't really need a nice
user interface, then the c:search command will do all for you.
Just put all your words in an ASCII file like this:

one eins un
two zwei deux
house Haus maison

Then you can issue the search command:  search vocab_file two
A special advantage is that you can search the other way round (give a
foreign word and retrieve the english one) with the *same* command.
And to make it really simple to use, you can make up a tiny AmigaDOS
script file in s: (name it "voc") like this:

.key word
search [path]vocab_file <word>

Finally give it a "protect s:voc +s", and then you can search for any
word with simply:

voc myword

Now, also AmigaDOS is easy.

-- 
Best regards, Dr. Peter Kittel  // E-Mail to  \\  Only my personal opinions... 
Commodore Frankfurt, Germany  \X/ {uunet|pyramid|rutgers}!cbmvax!cbmger!peterk