[www.theword.net]

Twitter live feed  
View unanswered posts | View active topics It is currently Sat Sep 23, 2017 3:53 am



Reply to topic  [ 24 posts ]  Go to page Previous  1, 2
 How to edit non-Bible modules (.twm) 
Author Message

Joined: Sat Sep 14, 2013 2:55 pm
Posts: 15
Post Re: How to edit non-Bible modules (.twm)
I'm putting together an Aramaic Peshitta Lexicon (dct.twm) for TheWord based on an eSword module.

But I'm not a fan of the Latin transliterated scheme that the esword module uses, so I'm converting the transliterated mumbo-jumbo into unicode Hebrew block script for the entries, or perhaps I'll assign numbers to the entries like Strongs ( such as <A1234> for Aramaic as opposed to <G1234> for Greek or <H1234> for Hebrew). I have all the data in excel worksheets and I'm ready to make a *.dct.twn file.

As preparation for doing so, I've been looking at other dct modules in SQLite Expert Pro, trying to reverse engineer them. But I am still very confused about one thing: Some dct modules--in the "main.topics_wordindex" table--have a "priority" field/column. What is it used for, what does it do, or what does it mean or indicate?


Sat Mar 22, 2014 6:27 am
Profile
Site Admin

Joined: Tue Aug 29, 2006 2:09 pm
Posts: 8551
Location: Corfu, Greece
Post Re: How to edit non-Bible modules (.twm)
Ignore the topics_wordindex table for now. This is maintained automatically, you should normally NOT populate this by yourself.
This is useful to populate yourse only if you want to make your dictionary do lookups with more words than those in the topics. Is that the case for you?

Costas


Sat Mar 22, 2014 10:06 am
Profile WWW

Joined: Sat Sep 14, 2013 2:55 pm
Posts: 15
Post Re: How to edit non-Bible modules (.twm)
Thank you Costas. I've taken your advice and have a basic Aramaic Lexicon module which satisfactorily accompanies the Peshitta NT in Hebrew + Vowels that I put together last week.

But try as I did, I could not figure out how to include Hebrew script included within the content of my dictionary. I had each entry formatted thus:

\par אבאש \par \par Vocalized: אַבֶאש \par \par Transliteration: 'a-VeSh \par \par Root: באש \par \par \par Definition: offended, be offended; ill-treat.

then I loaded it into main.content with SQLite Expert Pro and opened it in TheWord, but the three Hebrew words showed up garbled and unintelligible. What should I do to successfully put Hebrew script into main.content so it displays within TheWord correctly? I am good with VBA and managing and formatting data within Excel, and I'd like to find a way to automate the process with these rather than going entry by entry. Instead of putting text into main.content, do I have to enter it into the database as a "blob"? I'm not familiar with "blobs".

Thank you


Attachments:
PeshittaModScreenShot.PNG
PeshittaModScreenShot.PNG [ 74.55 KiB | Viewed 1338 times ]
Mon Mar 24, 2014 6:10 am
Profile
Site Admin

Joined: Tue Aug 29, 2006 2:09 pm
Posts: 8551
Location: Corfu, Greece
Post Re: How to edit non-Bible modules (.twm)
The content in the table should be in rtf format. In rtf you cannot have non-ascii characters. The Hebrew characters are such, and so need to be encoded accordingly. To encode a unicode character in rtf you use the notation \uN, where N is the decimal unicode code of the character (see the rtf spec here: http://www.biblioscape.com/rtf15_spec.htm#Heading9).

Of course, you can write a small VBA function to convert unicode text to such format, here is one in pascal:
Code:
function UnicodeToRTF(const ws: WideString): String;
const
  HEX: array[0..15] of char = ('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');
var
  i, j, c, len: Integer;
  si: String;
begin
  len := Length(ws);
  SetLength(result, len);
  c := 1;
  for i:=1 to Length(ws) do begin
    if c + 10 > len then begin
      Inc(len, 10000);
      SetLength(result, len);
    end;

    if ws[i] < #128 then begin
      result[c] := Char(ws[i]);
      Inc(c);
    end
    else begin
      result[c] := '\';
      result[c+1] := 'u';
      Inc(c,2);
      si := IntToStr(Ord(ws[i]));
      for j:=1 to Length(si) do
        result[c+j-1] := si[j];
      Inc(c, Length(si)+1);
      result[c-1] := '?'; // \uc1 is the default...
    end;
  end;
  SetLength(result, c-1);
end;



HTH
Costas


Mon Mar 24, 2014 11:36 am
Profile WWW

Joined: Sat Sep 14, 2013 2:55 pm
Posts: 15
Post Re: How to edit non-Bible modules (.twm)
Nice! This is what I've been looking for! Thank you Costas!


Mon Mar 24, 2014 4:04 pm
Profile

Joined: Wed Sep 23, 2009 4:13 pm
Posts: 604
Location: Brasília, Brazil
Post Re: How to edit non-Bible modules (.twm)
Here's the conversion in Perl:

Code:
sub UTF8AsRTF {
   my $text = shift;
   $text =~ s/([^[:ascii:]])/sprintf("\\u%d?",ord($1))/eg;
   $text;
}

_________________
Rúbio R. C. Terra
Brasília/DF - Brasil


Mon Mar 24, 2014 5:21 pm
Profile

Joined: Sat Sep 14, 2013 2:55 pm
Posts: 15
Post Re: How to edit non-Bible modules (.twm)
I use VB and VBA so I used this code:

Code:
Function UnicodeToRTF(Hebrew As String) As String
    Dim i As Integer
    Dim cc As Integer
    Dim L As Integer
    Dim u As String
   
    L = Len(Hebrew)
    u = ""

    For i = 1 To L
        cc = AscW(Mid(Hebrew, i, 1))
        u = u & "\u" & CStr(cc)
    Next i
    UnicodeToRTF = u
End Function


It worked like a champ! Now I just need to change the fontsize and color of the Hebrew. I guess I use \pnf and \pncf ?


Sat Mar 29, 2014 1:00 am
Profile

Joined: Sat Sep 14, 2013 2:55 pm
Posts: 15
Post Re: How to edit non-Bible modules (.twm)
Help, please. This is the format of each of my dictionary entries:

\cf1\fs28\b \u1488\u1463\u1489\u1464\u1488\b0 \cf0\fs24 \i (`a-Vo`) \i0
\par \b father; fruit. \b0
\par
\par Root: \u1488\u1489

The blue represents the Hebrew script. How can I make the first hebrew word dark red? I cannot figure it out.


Sat Mar 29, 2014 1:20 am
Profile
Site Admin

Joined: Tue Aug 29, 2006 2:09 pm
Posts: 8551
Location: Corfu, Greece
Post Re: How to edit non-Bible modules (.twm)
The best way to do this is to add \f1 for Greek and \f2 for Hebrew (and \fs22 for Greek and Hebrew). This way, tw will fix the colors itself.


Mon Mar 31, 2014 11:59 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 24 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.