第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

當(dāng)某些字母發(fā)生變化時(shí),如何在復(fù)數(shù)中找到單數(shù)?最好的方法是什么?

當(dāng)某些字母發(fā)生變化時(shí),如何在復(fù)數(shù)中找到單數(shù)?最好的方法是什么?

海綿寶寶撒 2023-07-29 13:40:34
當(dāng)某些字母發(fā)生變化時(shí),如何找到復(fù)數(shù)中的單數(shù)?以下情況:德語單詞Schlie?fach是“密碼箱”。復(fù)數(shù)是Schlie?f?cher.正如您所看到的,這封信a在 中發(fā)生了變化?。因此,第一個(gè)單詞不再是第二個(gè)單詞的子字符串,它們?cè)凇罢齽t表達(dá)式技術(shù)上”是不同的。也許我并不在下面我選擇的標(biāo)簽的正確角落。也許正則表達(dá)式不是適合我的工具。我已經(jīng)看到naturaljs( natural.NounIflector()) 為英語單詞提供了開箱即用的功能。也許德語也有同樣的解決方案?最好的方法是什么,如何在德語中找到復(fù)數(shù)中的單數(shù)?
查看完整描述

1 回答

?
POPMUISE

TA貢獻(xiàn)1765條經(jīng)驗(yàn) 獲得超5個(gè)贊

我曾經(jīng)不得不構(gòu)建一個(gè)文本處理器來解析多種語言,包括非常隨意的語言和非常正式的語言。需要確定的一件事是某些單詞是否相關(guān)(例如標(biāo)題中的名詞與一系列事物相關(guān) - 有時(shí)用復(fù)數(shù)形式標(biāo)記。)


IIRC,我們支持的所有語言中 70-90% 的單數(shù)和復(fù)數(shù)單詞形式的“編輯距離”小于 3 或 4。(最終添加了多個(gè)詞典來提高準(zhǔn)確性,因?yàn)椤熬嚯x”本身就會(huì)產(chǎn)生許多誤報(bào)。)另一個(gè)有趣的發(fā)現(xiàn)是,單詞越長,距離等于或小于 3 的距離就越有可能意味著意義上的關(guān)系。


這是我們使用的庫的示例:


const fastLevenshtein = require('fast-levenshtein');


console.log('Deburred Distances:')

console.log('Score 1:', fastLevenshtein.get('Schlie?f?cher', 'Schlie?fach'));

// -> 3

console.log('Score 2:', fastLevenshtein.get('Blumtach', 'Blumt?cher'));

// -> 3

console.log('Score 3:', fastLevenshtein.get('schlie?f?cher', 'Schliessfaech'));

// -> 7

console.log('Score 4:', fastLevenshtein.get('not-it', 'Schliessfaech'));

// -> 12

console.log('Score 5:', fastLevenshtein.get('not-it', 'Schiesse'));

// -> 8



/**

 * Additional strategy for dealing with other various languages:

 *   "Deburr" the strings to omit diacritics before checking the distance:

 */


const deburr = require('lodash.deburr');

console.log('Deburred Distances:')

console.log('Score 1:', deburr(fastLevenshtein.get('Schlie?f?cher', 'Schlie?fach')));

// -> 3

console.log('Score 2:', deburr(fastLevenshtein.get('Blumtach', 'Blumt?cher')));

// -> 3

console.log('Score 3:', deburr(fastLevenshtein.get('schlie?f?cher', 'Schliessfaech')));

// -> 7



// Same in this case, but helpful in other similar use cases.


查看完整回答
反對(duì) 回復(fù) 2023-07-29
  • 1 回答
  • 0 關(guān)注
  • 120 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)