LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices



Reply
 
Search this Thread
Old 12-14-2008, 05:44 AM   #1
kline
Member
 
Registered: Aug 2008
Location: Seattle
Distribution: Ubuntu
Posts: 74

Rep: Reputation: 0
How do I create words.db from words.txt using gdbm?


Hi Guys,

I'm working on updating and fixing a broken Makefile to create the rhyming dictionary. [[Originally pub domain from CMU]] Thru surfing all over I finally found the three missing *.txt files. The makefile doesn't give the instructions on howto create the three database files. It dies instantly when it can't find the first one.

I'm using the source rather than a pre-built binary for two reasons.
One, I'm a wool-died hacker; two, I want to port this to the Berkeley Unix distros. Some lexicographer put in a lot of effort in getting this (command-line) tool updated. I'd like to finish the build work.

Sorry for posting here; wasn't sure exactly *where*... .
 
Old 12-14-2008, 06:28 AM   #2
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
What sources are you using? I'm looking at the one in the Debian repo, and the db files are created by makedb. The source for this is included with the rhyme package, and is compiled and run by the makefile. The makefile is not broken, except for 'make test'. The db files are created from cmudict*, not the text files mentioned in the makefile.
 
Old 12-14-2008, 03:21 PM   #3
kline
Member
 
Registered: Aug 2008
Location: Seattle
Distribution: Ubuntu
Posts: 74

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by CroMagnon View Post
What sources are you using? I'm looking at the one in the Debian repo, and the db files are created by makedb. The source for this is included with the rhyme package, and is compiled and run by the makefile. The makefile is not broken, except for 'make test'. The db files are created from cmudict*, not the text files mentioned in the makefile.
I'm using the file

880 -rw-r--r-- 1 kline 896013 2008-12-14 11:44 rhyme-0.9.tar.gz

that seems to be identical with the .zip file. Good to know that the cmudict stuff is used; unless there is an ``official'' Debian tarball, I'll untar this and give it a go.

Is makedb part of Ubuntu or do i need to fetch is? locate doesn't see it. I'll fess up further to not have done any programming on my Ubuntu desktop. (I did try "gcc x.c" when I was running the last LTS release and got some err output. Returned to my FreeBSD box.)

Be nice if this tarball just-worked, but then, you know how it goes, :-)
 
Old 12-14-2008, 03:32 PM   #4
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
makedb is part of rhyme - you should see makedb.c and makedb.h in the tarball. This is from the tarball obtained by "apt-get source rhyme".
 
Old 12-14-2008, 04:12 PM   #5
kline
Member
 
Registered: Aug 2008
Location: Seattle
Distribution: Ubuntu
Posts: 74

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by CroMagnon View Post
makedb is part of rhyme - you should see makedb.c and makedb.h in the tarball. This is from the tarball obtained by "apt-get source rhyme".

Yeo, apt-get got the source, untarred, etc. But same or similar gotchas as before. This time I understand more. gcc can't see my #include headers. Probably more.

So, if this is too far OT, please let me know. Time to learn how to build stuff with gcc and g++. At a min. Hopefully, it is push-button.

If not, I'll put up a new post.

thanks much.
 
Old 12-14-2008, 04:22 PM   #6
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
What errors do you get? Do you have the gdbm dev library package installed?
 
Old 12-14-2008, 05:39 PM   #7
kline
Member
 
Registered: Aug 2008
Location: Seattle
Distribution: Ubuntu
Posts: 74

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by CroMagnon View Post
What errors do you get? Do you have the gdbm dev library package installed?
I was minus the libgdbm-dev stuff; once installed, make worked to a point. I will paste the errs in and hope they cp as I see them:




main.c:5:22: error: readline.h: No such file or directory
main.c:6:21: error: history.h: No such file or directory
main.c: In function \xe2\x80\x98getWord\xe2\x80\x99:
main.c:15: warning: implicit declaration of function \xe2\x80\x98readline\xe2\x80\x99
main.c:15: warning: return makes pointer from integer without a cast
main.c:17: warning: return makes pointer from integer without a cast
main.c:19: warning: return makes pointer from integer without a cast
main.c: In function \xe2\x80\x98main\xe2\x80\x99:
main.c:36: warning: implicit declaration of function \xe2\x80\x98using_history\xe2\x80\x99
main.c:37: warning: implicit declaration of function \xe2\x80\x98rl_bind_key\xe2\x80\x99
main.c:37: error: \xe2\x80\x98rl_insert\xe2\x80\x99 undeclared (first use in this function)
main.c:37: error: (Each undeclared identifier is reported only once
main.c:37: error: for each function it appears in.)
main.c:54: warning: implicit declaration of function \xe2\x80\x98add_history\xe2\x80\x99
main.c:63: warning: implicit declaration of function \xe2\x80\x98clear_history\xe2\x80\x99
make: *** [rhyme] Error 1


Yep. Okay the hex triplets are the html "``" and "''"; I'm almost positive. This is fairly easy to resolve with tr or perl, &c.

Another thing is that the headers are just not seen. Note the first two lines. I also tried a dummy x.c with
#include <stdio.h>
main{
}

and

main()
{
putchar('\n');
}

gcc complained about not finding stdio.h in my first try. The second time, x.c compiled to a.out perfectly and printed a newline. Is is cpp that finds the header files? Or the linker?
 
Old 12-14-2008, 05:59 PM   #8
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
cpp finds the header files, as they are compiled like all other source code.

The failure with headers is interesting, but do you actually have readline.h? (readline dev libraries)
 
Old 12-14-2008, 09:48 PM   #9
kline
Member
 
Registered: Aug 2008
Location: Seattle
Distribution: Ubuntu
Posts: 74

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by CroMagnon View Post
cpp finds the header files, as they are compiled like all other source code.

The failure with headers is interesting, but do you actually have readline.h? (readline dev libraries)
I only thought I did! And that sent me on yet other quests; I had no /usr/include/stdio.h either ... until some ~30 minutes ago. I just installed the entire g*-3.4 suite. Now everything works. Until your question, I'd assumed that Every 'Nix came with cc/gcc and header files installed. live and learn... .

thanks for your help!
 
  


Reply

Tags
database, output, text


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing words in txt files Raakh Linux - Newbie 3 11-15-2007 03:40 AM
use words instead of pictures? Four Programming 4 12-22-2006 04:43 AM
Words you've never used acid_kewpie General 26 12-23-2004 04:21 AM
Search and Replace: Asian Words to English Words ieeestd802 Linux - Software 0 10-27-2004 08:48 PM
there aren't any words... salparadise General 8 01-09-2004 05:05 AM


All times are GMT -5. The time now is 06:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration