Classic Computer Magazine Archive COMPUTE! ISSUE 80 / JANUARY 1987 / PAGE 10

readers feedbackReaders' Feedback


The Editors and Readers of COMPUTE!



Language Translators
I need a program to translate Swedish into English, and vice versa. I have talked to many software dealers in large cities, and they tell me they know of no such program. If there is a program that can handle this task, please let me know.
Kenneth E. Pilquist

Unfortunately, general language-translation programs are probably years away, even for the largest and fastest computers. In the 1960s, some computer scientists believed that such programs were just around the corner. Some elaborate attempts were made, but the failures were often more notable than the successes. For example, one English-to-Russian program translated the English phrase The spirit is willing, but the flesh is weak into the Russian equivalent The vodka is strong, but the meat is raw.
    Perhaps the major obstacle in the way of such programs is that human languages depend heavily on context. That is, the same word can signify many different things depending on how it's used. To take a simple example, consider the verb cast. It commonly means to throw, as in the phrase cast your nets on the water. But it carries very different meanings in the phrases cast a ballot, cast parts in a play, or cast a cement foundation. The task becomes even more complex if you include specialized, technical definitions. In the C programming language, for instance, cast denotes a particular sort of conversion from one variable type to another.
    In order to translate the verb cast reliably, a translation program would need to include fairly large amounts of real-world information about such dissimilar subjects as fishing, voting, theatrical management, and building construction. Without meaningful information about all the contexts in which a word can appear, translator programs can easily produce blunders such as mistranslating spirit as vodka.
    With these limitations in mind, however, you can use your computer as a simple language dictionary. Try this program.

10 DIM A$(20),B$(20),C$(20):RE
   M FOR ATARI ONLY

20 NUMWORDS=2
30 PRINT "1) ENGLISH TO SWEDIS
   H"

40 PRINT "2) SWEDISH TO ENGLIS
   H

50 INPUT I:IF I<>1 AND I<>2 TH
   EN 30

60 PRINT "WHAT IS THE WORD";:I
   NPUT C$:RESTORE

70 FOR J=1 TO NUMWORDS
80 READ A$,B$
90 IF I=1 THEN IF A$=C$ THEN P
   RINT B$:GOTO 30

100 IF I=2 THEN IF B$=C$ THEN
   [SPACE}PRINT A$:GOTO 30

110 NEXT J:PRINT "WORD NOT IN
   {SPACE}DICTIONARY"

120 GOTO 30
10000 DATA CAT,KATT
10001 DATA I,JEG

    You can add more words and phrases to the DATA statements at the end of the program. When you are finished, put the number of words into line 20. You may find that when you add many words to the list, the program starts slowing down, so try to keep the most-used words at the beginning of the list. If the program is still too slow, you might consider rewriting the program to use a binary search. This would require a list sorted in alphabetical order.