Reply to post

Helpful ReplyHot![FAQ]Use custom speech replacement with specific articles, read lists or web origin articles

Author
Admin
Administrator
  • Total Posts : 275
  • Reward points: 0
  • Joined: 2010/11/22 00:00:00
  • Location: USA
  • Status: offline
2016/09/24 08:20:51 (permalink)

Use custom speech replacement with specific articles, read lists or web origin articles

There is a way in @Voice to use custom speech filters for different files, directories etc. – therefore also for the lists, if you save each list articles in a different folder… It can be done with @Voice filters feature. Here is an example if you have e.g. a specialized speech filter for medical terminology: create a file named something.json, e.g. medical.json, inside the Filters sub-folder of the main @Voice folder. Inside that file put the following text:
 
{
  "extractor": "default",
  "file": ".*/medical/.*",
  "title": "Medical terms speech filter",
  "speechFilt": "medical-replace-eng.txt"
}
 
Also create and place in the same Filters folder, a speech replacement files named medical-replace-eng.txt. Put all your files from the “medical” reading list into a sub-folder named medical, and you’re all set… Let me know if this works for you.
 
The “file” field is a RegEx expression for a file name, so instead of putting your articles into a specified folder, you could add something unique to the file name for example. But more importantly, instead of “file”, you could use “url” field and use the specific filter for all articles from any web site matching the URL address RegEx. Here is an example of a more complex filter that does it:
 
{
  "extractor": "full",
  "disabled": false,
  "url": "http://(www\\.orthobullets\\.com/)|(www\\.medbullets\\.com/)",
  "title": "Orthobullets - educational resource for orthopaedic surgeons",
  "speechFilt": "orthobullets-replace-eng.txt",
  "nodeAdd": [
    { "tag": "h1", "attrib": [{ "name": "id", "val": "ctl00_content_lblTopicTitle" }]},
    { "tag": "div", "attrib": [{ "name": "id", "val": "topic-content" }]},
    { "tag": "h2""attrib": [{ "name": "id", "val": "ctl00_content_qbankTitle" }]},
    { "tag": "div", "attrib": [{ "name": "class", "val": "topicquestion" }]}
  ],
  "nodeRemove": [
    { "tag": "h2", "attrib": [{ "name": "class", "val": "i_inline" }]},
    { "tag": "div", "attrib": [{ "name": "id", "val": "allComments|responseMessage|ctl\\d+_content_rptQuestions_ctl\\d+_QuestionItem1_Div12" }]},
    { "tag": "div", "attrib": [{ "name": "style", "val": ".*border: 1px.*" }]},
    { "tag": "div", "text": "^[\\s]*TAG[\\s]*$" },
    { "tag": "div", "attrib": [{ "name": "class", "val": "figures_place" }]},
    { "tag": "a", "attrib": [{ "name": "id", "val": "ctl\\d+_content_rptQuestions_ctl\\d+_QuestionItem1_A1" }]}
  ],
  "edit": [
    { "repeat": true, "from": "\\(OBQ\\d+\\.\\d+\\)", "subst": "(Question [q:1:1])" }
  ]
}
 
This filter does also customized content extraction with “nodeAdd” and “nodeRemove” fields, and some content editing in the extracted text, but if you don’t need it, just use this part:
 
{
  "extractor": "default",
  "url": "http://(www\\.orthobullets\\.com/)|(www\\.medbullets\\.com/)",
  "title": "Orthobullets - educational resource for orthopaedic surgeons",
  "speechFilt": "orthobullets-replace-eng.txt"
}
 
Greg
post edited by Admin - 2017/02/07 19:47:39
david.dupont
User
  • Total Posts : 20
  • Reward points: 0
  • Joined: 2015/04/10 03:37:04
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2016/09/26 03:08:09 (permalink)
Thnkas Greg
I will test that.
 
With this it could be more more easy to share replace.txt with other users.
Kate
User
  • Total Posts : 0
  • Reward points: 0
  • Joined: 2018/08/28 08:16:37
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2018/09/01 08:37:03 (permalink)
Hope it will be useful to me, thanks!
Sorawut
User
  • Total Posts : 0
  • Reward points: 0
  • Joined: 2019/01/21 07:50:55
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2019/01/22 02:31:41 (permalink)
Hi, 
 
I have tried follow your guide above but it did not work. 

I have created 2 files below to test.

File#1 \.config\filters\medical.json

{
  "extractor""default",
  "url""https://(www\\.orthobullets\\.com/)|(www\\.medbullets\\.com/)",
  "title""Orthobullets - educational resource for orthopaedic surgeons",
  "speechFilt""orthobullets-replace-eng.txt"
}

File#2 \.config\filters\orthobullets-replace-eng.txt

*".+" " Test "
Admin
Administrator
  • Total Posts : 275
  • Reward points: 0
  • Joined: 2010/11/22 00:00:00
  • Location: USA
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2019/01/22 07:26:31 (permalink)
I really don't understand what you want to achieve. Are you a medical doctor, studying for exams from orthobullets.com or medbullets.com web sites? What exactly do you want to do? What kind of files you want to filter and how, where are they located or from where they are downloaded?
 
Greg
Sorawut
User
  • Total Posts : 0
  • Reward points: 0
  • Joined: 2019/01/21 07:50:55
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2019/01/22 11:44:10 (permalink)
Ok, let see the real.

Link
https://www.facebook.com/...98408/398138307416753/

File#1 \.config\filters\facebook.json
{
"extractor": "full",
"url": "https://www\\.facebook\\.com/",
"title": "Facebook",
"speechFilt": "facebook-replace-tha.txt"
}

File#2 \.config\filters\facebook-replace-tha.txt
*"^(Jump to|Sections of this page|Other pages on Facebook|Accessibility help|Press alt \+ \/ to open this menu|Home|Posts|Photos|Community|Videos|Events|About|Info and ads)$" ""
Admin
Administrator
  • Total Posts : 275
  • Reward points: 0
  • Joined: 2010/11/22 00:00:00
  • Location: USA
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2019/01/22 17:44:39 (permalink)
I would have to double check the regex you wrote for correctness, however one thing that needs to be different: the filter files named facebook.json and facebook-replace-tha.txt should be placed in a sub-directory named Filter of the main @Voice app directory, i.e. it would be under a path similar to this:
 
/sdcard/Android/data/com.hyperionics.avar/files/Filters/facebook.json
/sdcard/Android/data/com.hyperionics.avar/files/Filters/facebook-replace-tha.txt
 
the directory under .config/filters is for app use only, the filters there are downloaded from my web site, which I add and update periodically as needed. User filters placed there take no effect.
post edited by Admin - 2019/01/22 17:47:26
Sorawut
User
  • Total Posts : 0
  • Reward points: 0
  • Joined: 2019/01/21 07:50:55
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2019/01/22 21:03:53 (permalink)
Thank you so much, it works now.
 
I have changed "facebook-replace-tha.txt" to
 
*"\>(Jump to|Sections of this page|Other pages on Facebook|Accessibility help|Home|YouTube|Videos|Events|Liked|Posts|About|Notes|Reviews|Photos|Groups|Community|Info and ads)<" "><"
*"Press .+ to open this menu" ""
post edited by Sorawut - 2019/01/22 22:33:03
slachizh
User
  • Total Posts : 0
  • Reward points: 0
  • Joined: 2019/03/05 02:03:27
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2019/03/05 04:14:36 (permalink)
Hello.
I do for my daughter the sound of English educational texts. For some unfamiliar words, next to them, in angle brackets, i insert their transcription and translation or just translation. It looks something like this:
-------------------------------------------------------------------------------------------------------------------------
And, since the most effective spur <[spɜː] стимул> to learning a language (or anything else) is interest, every effort has been made to cover the linguistic pill with the jam of gaiety <['geɪətɪ] веселье>. So, as soon as the preliminaries <[prɪ'lɪmɪn(ə)rɪs] основы, начальные сведения> are mastered <овладевать>, the reader is introduced to Mr. Priestley, his household <семейство, домашние> and his group of students. We see them here and in subsequent <последующих> books chatting together, telling jokes, reading stories that they have written, singing songs or acting short plays. It is on these conversations and stories and the “talks by Mr. Priestley” that the language teaching is based, and from them that the copious <['kəupɪəs] богатые, обширные> exercises by which the teacher is enabled to test how far the work has been understood, are drawn <вытянута>.
---------------------------------------------------------------------------------------------------------------------------
To cancel their dubbing, I insert the following sample into RegEx:
\&lt;.+\&gt;
and leave the replacement blank.
But the speech stops at the first met < and continues until the last > of the paragraph.
After that speech is starting again and again till the next first <, again stops till the last > of next paragraph.
So, what i do wrong here????
 
Admin
Administrator
  • Total Posts : 275
  • Reward points: 0
  • Joined: 2010/11/22 00:00:00
  • Location: USA
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2019/03/06 16:33:23 (permalink) ☄ Helpfulby slachizh 2019/03/07 00:18:51
Hello,
it's a smart thing you do for your daughter! Another thing you could suggest to her, is to long-press and unfamiliar word in text inside @Voice window. The "reference toolbar" then pops up and the word you pressed is selected. In this toolbar, press the 2nd button from left to pop-up Google Translate and see the translation of the word. She may also select longer fragments, or long-press a word twice to select the whole sentence, then try Google Translate. It's not perfect, but helps often.
 
As to your question about RegEx expressions, it's something that I struggle with too. This is because normally the RegEx search is "greedy", it tries to grab as much text as possible into its match. This is why it continues to the last > character in the sentence. The fix is easy enough: use the RegEx non-greedy operator, modify your RegEx pattern like this:
 
\&lt;.+?\&gt;
 
For more information on this, search Google for "RegEx non-greedy" term. Good luck to you and your daughter!
 
Greg
slachizh
User
  • Total Posts : 0
  • Reward points: 0
  • Joined: 2019/03/05 02:03:27
  • Status: offline
Re: Use custom speech replacement with specific articles, read lists or web origin article 2019/03/07 03:35:26 (permalink)
Thanks, Greg
It's really working
 
Jump to:
© 2019 APG vNext Commercial Version 5.1