Page 1 of 1

Insert a hide reference in my text.

Posted: Mon Apr 16, 2012 12:28 pm
by alexandreq
Hello Sergey,

I need your help in a process that I need to do.

Let me explain.

When I get a word from my text, I insert it into a Table, this table has 3 fields:

EnglishWord
PortugueseWord
IndexWord
IdText

My text is in english and when I get some words from it, I insert into this table so that I can inform in the field PortugueseWord its translation. Well, It is ok so far, I already do this.

My problem is being here:

As you can see, There is another field named IndexWord, this field is the ID sequence of list words in table, I need a way to have a reference the word that was copied from text in it.

For example this Text:
The Beatles were an English rock band formed in Liverpool in 1960, and one of the most commercially successful and critically acclaimed acts in the history of popular music. The group's best-known lineup consisted of John Lennon (rhythm guitar, vocals), Paul McCartney (bass guitar, vocals).
If I took the word "acclaimed" , I'd like to insert by its side the reference id that the word is the x number in my list table, so that when I click on the word in my list it can be found.

I could use the search word, but the problem is that the list can have more than one word, that is, a repeated word. Better, I can have "acclaimed" twice or four times in my list word, because a word can have several meaning and its meaning depends on the context.

This number by its side can't be visible, it must be hide.

My doubt are:

1) How can I insert a number by its side in a hide way?
2) How can I search this hide number?

I am not sure if this is the better way to do that. If you have any better ideia, you're welcome.

Thanks
Alex

Posted: Mon Apr 16, 2012 5:05 pm
by Sergey Tkachenko
Is this text read-only? In this case, I think the best way is storing this information outside the document, as ("word position", IndexWord) pairs.
I can suggest how to calculate "word position".

If you want to store this information directly in the document, you have the following options.

1) Using tags. Tag is a string value associated with each item in the document. Normally, they are used to store hyperlink targets, but you can use them for your needs.
There is a problem: tags is an item property, and one text item may contain several words. So you can add each word as a separate item with its own tag (quite inefficient, but ok for not too large documents)

2) Using tags. Not separating items into words, but a text item can store in tags a list of values for all words in it.

3) Inserting a hidden text after words (actually, it also means separating text items into words)