TTS Class: How to TTS chinese Pinyin? - android

Is there a way to TTS output Pinyin via the tts class (in the correct tone)?
I tried SVOX and Pico...
I have a database where different words are stored in a form like
Ni3
Hao3
I tried:
- Ni3Hao3 -> result: NiSanHaoSan (San means 3).
- Nín hǎo -> result: N i n h o (Only speaking letters, missing the a)
I thought about using a table givin to every word - sound combination one chinese utf sign. But that seems to be absurd.
Is there a way to handle this?

U might try the jtts which depends on espeak.

Related

Make voice pause between phrases on Android (TalkBack and Text-To-Speech)

I am setting the content description for a TextView using setContentDescription method.
The string passed to this method is a concatenation of two sentences separated by a period "."
When TalkBack ot TTS (Text-To-Speech) read this, it does not mark a pause between the two sentences.
My question is, is there a some way to handle this, a special UTF character for example ?
Try a newline charachter.
To read this barcode: "3S REGR 2345", I found that "3 S\nR E G R\n2 3 4 5" got me the result I was after on Samsung TTS.
It will be read as "Three S. R E G R. Two Three Four Five"
Uncertain if there is any special character available, but another solution might be to split the speech and add
textToSpeech.playSilence(750, TextToSpeech.QUEUE_ADD, null);
then continue with the rest of the split

Android Studio unknown keycode - keymaps don't work with letters

That's what I have now: fresh installed Fedora 21, GNOME3 and Android Studio. Two KB languages: ru and en. Whatever is done further is done with "en" input language chosen. System language is Russian.
What I do: try any Ctrl or Ctrl-Alt or Ctrl-Shift shortcuts with any letter. No result at all. Ctrl-Alt-L should reformat code, but does nothing, same thing with Ctrl-Shift-F, for example. Meanwhile, combo with any number or +/-/= sign or arrows works well.
So what can be wrong? When I go to Setting->Keymaps and try the button "Find Actions by shortcut", press a combo there, it finds non-letter maps very well, but as I press combo with any button, it outputs, for example, "Ctrl+Alt+ unknown keycode 0x0"
Got a terrible headache with this... Any ideas?
Looks like you have non-US layout as a default one. Java doesn't like it and generates events with invalid keycodes. I'm not sure we can develop an easy workaround for the issue. As a countermeasure you can assign US a primary layout.

Changing text input to also treat "u" as "ü", "ss" as "ß", etc. for word suggestions

I have the following idea:
In German we have four extra letters (ä, ö, ü, ß) and I don't know any other language which has these vocals but I think French people with their accents also know this problem. We have a lot of apps in the Google Play store for cities, bus stations, trains and other stuff like that. Now it is really exhausting that we always have to write these letters if we are on the go. It would be much easier to write Munchen (=München [de] = Munich [en]), Osterreich (Österreich [de] = Austria [en]) or something like Uberwasserstrasse (Überwasserstraße [de] = Over-Water-Street [en]). So my question is now:
A lot of apps show suggestions for our just typed word. I think in the code it is something like this:
String current = editText.getText().toString();
db.lookUp(current); // Of course SQL statement
Can we hook this so that Android thinks that we have typed an ä, ö, ü, ß if we write an a, o, u, ss and the system looks for words with one of these vowels and suggests both? Here I do not want to ask for code - I want to discuss if we are able to write a hack or hook for the Android system. Also, root-rights can be assumed with the solution. I'm looking forward to your ideas.
You could do this the other way around, by "normalizing" typed characters into their related non-diacritical versions. You can use the java.Text.Normalizer class for this. A good snippet can be found in this article:
public static String removeAccents(String text) {
return text == null ? null :
Normalizer.normalize(text, Form.NFD)
.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
}
When applied to "Münich", this returns "Munich". That way, you can use a simple string comparison using these normalized versions.
This wouldn't work for "ß" though. If that's the only special case, you could handle it separately.
What you are looking for is called accent-insensitive collating sequence. SQLite's COLLATE operator can be used to do such searches, but I learned from another post that there might be bugs you'll need to look out for.

Android Replace "..." with ellipsis character

Since AVD tools 16 I'm getting this warning:
Replace "..." with ellipsis character (..., …) ?
in my strings.xml
at this line
<string name="searching">Searching...</string>
How do I replace ...? Is it just literally …?
Could someone explain this encoding?
… is the unicode for "…" so just replace it. It's better to have it as one char/symbol than three dots.
To make thing short just put … in place ...
Link to XML character Entities List
Look at Unicode column of HTML for row named hellip
If you're using Eclipse then you can always do the following:
Right click on the warning
Select "Quick Fix" (shortcut is Ctrl + 1 by default)
Select "Replace with suggested characters"
This should replace your three dots with the proper Unicode character for ellipsis.
Just a note: The latest version of ADT (21.1) sometimes won't do the replace operation properly, but earlier versions had no problem doing this.
This is the character: …
The solution to your problem is:
Go to Window -> Preferences -> Android -> Lint Error Checking
And search for "ellipsis". Change the warning level to "Info" or "Ignore".
This answer is indirectly related to this question:
In my case textView1.setTextView("done&#8230"); was showing some box/chinese character. Later, I checked into fileformat.info for what the value represents and I found this is a Han character.
So, what to do? I searched for "fileformat.info ellipse character" and then everything became clear to me once I saw its values are;
UTF-16 (hex) 0x2026 (2026)
UTF-16 (decimal) 8,230
So, you have several encoding available to represent a character (e.g. 10 in Decimal is represented as A in hexa) so it is very important to know when you are writing an unicode character, how receiving function decodes it. If it decodes as decimal value then you have to provide decimal value, if it accept hexadecimal then you have to provide hexadecimal.
In my case, setTextView() function accepts decimal encoded value but I was providing hexadecimal values so I was getting wrong character.
The quick fix shortcut in Android Studio is Alt + Enter by default.
Best not to ignore it as suggested by some, it seems to me. Use Android Studio to correct it (rather than actually typing in the character code), and the tool will replace the three dots with the three-dot unicode character. Won't be confusing to translators etc.

Android: Searchable Dictionary error: (R.raw.definitions)

I am new to android and I started this sample from google but i have a problem and couldn't get pass it.
This line has an error in DictonaryDatabase.java.
InputStream inputStream = resources.openRawResource(R.raw.definitions);
and the error says "raw cannot be resolved or is not in a field."
I have imported the Java.R but this didn't seem to fix it.
I also have created a raw folder but didn't fix it.
thanks for your help.
you need to add definitions.txt. file directory should luk like this /res/raw/definitions.txt .It is just soft copy of dictionary.
and copy below texts inside that definition.txt file
i entered just 'A' and 'B' letters. If u get any text of dictionary words just copy those words till letter 'Z' in this definition file
abbey - n. a monastery ruled by an abbot
abide - v. dwell; inhabit or live in
abound - v. be abundant or plentiful; exist in large quantities
absence - n. the state of being absent
absorb - v. assimilate or take in
abstinence - n. practice of refraining from indulging an appetite especially alcohol
absurd - j. inconsistent with reason or logic or common sense
boycott - n. a group's refusal to have commercial dealings with some organization in
breach - n. an opening (especially a gap in a dike or fortification)
caricature - n. a representation of a person that is exaggerated for comic effect
casual - j. without or seeming to be without plan or method; offhand
I just solved it removing this line
import android.R;
R is a special class holding identifiers of all your resources. It is automatically generated to match the content of your res folder. According to your error, you haven't added raw/definitions to your res folder. You are trying to access a non-existent resource.
it seems you need
import android.R;

Categories

Resources