New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

Recommended dictionary supports TAB-delimited text

All about dictionaries

Recommended dictionary supports TAB-delimited text

Postby fengdaolong » Sun Apr 28, 2013 5:29 am

I have a lot of TAB-delimited text dictionary,The format is:
Code: Select all
keyword{tab}Definition
keyword{tab}Definition
keyword{tab}Definition
keyword{tab}Definition
.............

Every time it is converted into the format supported by the GoldenDict before use, e.g. StarDict dictionaries (.ifo, .dict, .idx, and .syn files),is very inconvenient. Recommendations GoldenDict able to directly read the text file as a dictionary to use.
Last edited by fengdaolong on Sun Apr 28, 2013 10:14 am, edited 1 time in total.
fengdaolong
 
Posts: 3
Joined: Sat Apr 27, 2013 1:30 pm

Re: Recommended dictionary supports TXT format

Postby Tvangeste » Sun Apr 28, 2013 5:39 am

I would recommend to use DSL format for such dictionaries, it is a plain text format and very easy to work with.

In your case the dictionary would look like this:

Code: Select all
#NAME "Sample DSL Dictionary"
#INDEX_LANGUAGE   "English"
#CONTENTS_LANGUAGE   "English"

keyword
    definition
keyword2
    definition2
keyword3
    definition3


Basically, headwords start at the beginning of the line. The definitions start after spaces or tabs, on the new line. So, to convert your tab-delimited data into a DSL dictionary, all you need to do is to add 3-line header on top and to replace TAB by Carriage return + TAB.

More advanced DSL sample is here: https://github.com/VVSiz/SampleDSL
Tvangeste
 
Posts: 893
Joined: Thu Jun 02, 2011 11:42 am

Re: Recommended dictionary supports TXT format

Postby fengdaolong » Sun Apr 28, 2013 8:12 am

DSL format is not as easy as TAB delimited text file,You can not use Excel to edit it casually,If the definition of a line break even harder.
I hope GoldenDict support custom delimited text file,The left side of the delimited is keyword,the right side of the delimited is Definition.The definition of carriage returns and line breaks can use the escape character, such as: "\ r\ n".
This file can easily use any text editor to edit, just like Excel to edit the CSV file.Also, you can easily exchange data with other databases.
fengdaolong
 
Posts: 3
Joined: Sat Apr 27, 2013 1:30 pm

Re: Recommended dictionary supports TAB-delimited text

Postby midoziad » Sun Apr 28, 2013 2:37 pm

hi Tvangeste,
could you tell us what is the carriage return symbol in word, excel or notepad++; so that I could change my files to DSL format. I have files like these:
Code: Select all
headword1
translation1
headword2
translation2
midoziad
 
Posts: 17
Joined: Sun Dec 30, 2012 6:14 pm

Re: Recommended dictionary supports TAB-delimited text

Postby Tvangeste » Sun Apr 28, 2013 4:57 pm

midoziad wrote:hi Tvangeste,
could you tell us what is the carriage return symbol in word, excel or notepad++; so that I could change my files to DSL format. I have files like these:
Code: Select all
headword1
translation1
headword2
translation2

Carriage return is what you type when you press "Enter", basically a new line. So, the headwords should start right from the beginning of the new line, and the translations should start after some spaces or tabs.

For example:

Code: Select all
headowrd1
  translation line 1
  translation line 2
  translation line 3
Tvangeste
 
Posts: 893
Joined: Thu Jun 02, 2011 11:42 am

Re: Recommended dictionary supports TAB-delimited text

Postby Tvangeste » Sun Apr 28, 2013 7:30 pm

Here's how to split tab-separated entries into a two lines, suitable for DSL dictionary, in Notepad++:

Press Ctrl+H for search and replace dialog.

Code: Select all
Find what: ^(\S.*?)\t+(.*)$
Replace with: \1\n\t\2
Search Mode: Regular expression
Tvangeste
 
Posts: 893
Joined: Thu Jun 02, 2011 11:42 am

Re: Recommended dictionary supports TAB-delimited text

Postby midoziad » Sun Apr 28, 2013 9:49 pm

Tvangeste wrote:Here's how to split tab-separated entries into a two lines, suitable for DSL dictionary, in Notepad++:

Press Ctrl+H for search and replace dialog.

Code: Select all
Find what: ^(\S.*?)\t+(.*)$
Replace with: \1\n\t\2
Search Mode: Regular expression

thank you Tvangeste. this will help me a lot. :D
midoziad
 
Posts: 17
Joined: Sun Dec 30, 2012 6:14 pm

Re: Recommended dictionary supports TAB-delimited text

Postby Tvangeste » Mon Apr 29, 2013 9:06 pm

fengdaolong, do you know that there is a tool in Stardict distribution that could convert a TAB-file into a stardict dictionary with just a single button click?

Namely, the name of the tool that allows to do that is Stardict-Editor.
Tvangeste
 
Posts: 893
Joined: Thu Jun 02, 2011 11:42 am

Re: Recommended dictionary supports TAB-delimited text

Postby fengdaolong » Tue Apr 30, 2013 1:38 pm

I know, but I think not compiled TAB text easier to edit and update the content and to exchange any database at any time.
fengdaolong
 
Posts: 3
Joined: Sat Apr 27, 2013 1:30 pm

Re: Recommended dictionary supports TAB-delimited text

Postby Tvangeste » Tue Apr 30, 2013 3:57 pm

fengdaolong wrote:I know, but I think not compiled TAB text easier to edit and update the content and to exchange any database at any time.

Yep, agreed.
Tvangeste
 
Posts: 893
Joined: Thu Jun 02, 2011 11:42 am


Return to Dictionaries

Who is online

Users browsing this forum: No registered users and 29 guests