当字符串包含撇号(单引号)时遇到问题。正在开发词汇学习应用程序(法语/英语)。用户必须回答测验。手机会告诉用户他/她输入的翻译是否正确。
只要有撇号,该字符串就无法识别。
例如:“一片草叶”:“un brin d'herbe”/“蜂巢”:“Un nid d'abeilles”。
为了检查答案,我将链分成一个列表:[un,nid,d'abeilles]
即使用户输入“d'abeilles”,它也永远不会被识别为正确的。
我注意到语音转文本功能也存在同样的问题:如果用户说“s'habiller”(穿衣服)这个词,我的搜索功能永远找不到它。
有人知道为什么会发生这种情况吗?这会是一个“颤振”错误吗?
在应用程序中,我有一个使用 Microsoft Excel 创建的词库,然后导入到 Visual Studio 中。词库由具有一系列参数的 WORD 对象组成。这是一片草叶。
Word(
id: 37,
level: 6,
main: "blade of grass",
mainFr: "brin d'herbe",
theme: [
T(
e: "house",
f: "maison",
ste: ["in the garden"],
stf: ["dans le jardin"]),
T(
e: "nature",
f: "nature",
ste: ["in the meadow"],
stf: ["dans la prairie"])
],
articleEng: "a",
articleFr: "un",
nature: "noun",
plur: "blades of grass ",
ortho2: "",
phon: "ˈbleɪd əv ˈgrɑːs",
son: "",
remPhon: "",
french: [],
syn: [],
ant: [],
wDef: "a single thin flat piece of grass.",
wPhrase: "There was no wind at all. Not a leaf or blade of grass moved.",
wPhraseFr:
"Il n'y avait pas de vent du tour. Pas une feuille ni un brin d'herbe ne bougeait.",
past: [],
idiomsEn: [],
idiomsFr: [],
marqueur: "",
remarque: "",
),