Jump to content

fetching from a text based database


esafwan

Recommended Posts

hi,

i have a database file in .txt its a regional dictionary file released under GPL.

 

below is the model!

 

 

abbey

1. കന്യകാമഠം

2. മഠത്തോട് ബന്ധപ്പെട്ട ദേവാലയം

3. സന്യാസിമഠം

abbot

1. മഠാധിപതി

abbreviate

1. സംക്ഷേപിക്കുക

2. സംഗ്രഹിക്കുക

3. ചുരുക്കുക

abbreviation

1. സംഗ്രഹിക്കല്*

2. ചുരുക്കം

3. ചുരുക്കെഴുത്ത്.

 

How do u i fetch a word from it? Like if any one type abbey in a textbox, the first word in this sample, it should return the meanings numbered 1,2 & 3.

 

How can it be done? can any one give me a sample code? Its for making a free software.

Link to comment
https://forums.phpfreaks.com/topic/157420-fetching-from-a-text-based-database/
Share on other sites

That is not a database of any type. You are able to query databases for data, text files (like this) you will need to parse yourself.

 

I don't see any real patterns in this text file so its probably not going to be a straight forward task. Id suggest reading up on regular expressions.

search through the file line by line. compare the textfield with the line until you find the keyword. when you find the keyword return all lines that start with a number until you hit one without a number.

 

the file is probably huge if it's a dictionary so the search may be really slow.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.