是有詞幹像(印地文,泰盧固語)印度語言的任何實現都可以....是沒有可用於印度語言的任何詞幹
回答
Hindi Analyzer,與詞幹,可在Lucene的。它基於這個algorithm(pdf)。
hindi_stemmer是Ananthakrishnan Ramanathan和Durgesh D Rao在「A Lightweight Stemmer for Hindi」中描述的印地語詞幹的Python實現。
我是使用它,但它給我錯誤。該怎麼辦? – 2015-02-28 18:07:03
可能你不再看着這個,但是錯誤是什麼? – 2016-07-24 21:39:24
我們創造的原代碼Python Hindi Stemmer
雖然原來的印地文詞幹的作者的方式使用可變升的Java版本還不是很清楚,但有一個完整的代碼什麼工作
進口java.util中。數組列表; import org.apache.commons.lang.StringUtils;
public class SimpleHindiStemmer {
/* This is not coming while pasting the code better copy from Python Code as given in suffixes[1] */
private static String [] stem1 = new String [] { "ो", "े", "ू", "ु", "ी", "ि", "ा" };
/* This is not coming while pasting the code better copy from Python Code as given in suffixes[2] */
private static String [] stem2 = new String [] { "कर", "ाओ", "िए", "ाई", "ाए", "ने", "नी", "ना", "ते", "ीं", "ती", "ता", "ाँ", "ां", "ों", "ें" };
private static String [] stem3 = new String [] { "ाकर", "ाइए", "ाईं", "ाया", "ेगी", "ेगा", "ोगी", "ोगे", "ाने", "ाना", "ाते", "ाती", "ाता", "तीं", "ाओं", "ाएं", "ुओं", "ुएं", "ुआं" };
private static String [] stem4 = new String [] { "ाएगी", "ाएगा", "ाओगी", "ाओगे", "एंगी", "ेंगी", "एंगे", "ेंगे", "ूंगी", "ूंगा", "ातीं", "नाओं", "नाएं", "ताओं", "ताएं", "ियाँ", "ियों", "ियां" };
private static String [] stem5 = new String [] { "ाएंगी", "ाएंगे", "ाऊंगी", "ाऊंगा", "ाइयाँ", "ाइयों", "ाइयां" };
private static ArrayList<String []> stemList = new ArrayList<String []>(5);
static int [] cut = new int [] { 0, 1, 1, 1, 2, 2 };
static {
stemList.add(stem5);
stemList.add(stem4);
stemList.add(stem3);
stemList.add(stem2);
stemList.add(stem1);
}
public SimpleHindiStemmer(){
}
public static void main(String [] argv){
SimpleHindiStemmer sm = new SimpleHindiStemmer();
String word = "रास्ते";
System.out.println(sm.stemprocess(word));
}
public String stemprocess(String word){
int wlen = word.length();
int wordlen = wlen*3;
int icnt = 5;
for (String [] stemwords : stemList){
if(wordlen > (icnt + 1)){
for(String sw: stemwords){
if(StringUtils.endsWith(word, sw)){
return StringUtils.substring(word, 0, wlen - cut[icnt]);
}
}
}
icnt--;
}
return word;
}
}
正如你所看到的utf-8字符在某些情況下沒有很好的捕獲。看看原始的Python代碼,並從那裏複製後綴值。
import java.util.Map;
import java.util.WeakHashMap;
/** * 印地文光stemmer-刪除號碼,性別和情況下,從名詞後綴和形容詞
public class HindiStemmerLight{
/**
* A cache of words and their stems
*/
static private Map<String, String> cache = new WeakHashMap<String, String>();
/**
* A buffer of the current word being stemmed
*/
private StringBuilder sb = new StringBuilder();
/**
* Default constructor
*/
public HindiStemmerLight() {
}
public String stem(String word) {
String result = cache.get(word);
if (result != null)
return result;
//
sb.delete(0, sb.length());
//
sb.append(word);
/* remove the case endings from nouns and adjectives */
remove_suffix(sb);
result = sb.toString();
cache.put(word, result);
return result;
}
private void remove_suffix(StringBuilder word) {
int len = word.length() - 1;
/* article */
if (len > 4) {
if (word.substring(len- 2, len+1).equals("िया")) {
word.delete(len-2 , len + 1);
return;
}
if (word.substring(len- 2, len+1).equals("ियो")) {
word.delete(len-2 , len + 1);
return;
}
} /* end if len >4 */
if (len > 3) {
if (word.substring(len-1, len+1).equals("ाए")) {
word.delete(len - 1, len + 1);
return;
}
if (word.substring(len-1, len+1).equals(" ाओ")) {
word.delete(len - 1, len + 1);
return;
}
if (word.substring(len-1, len+1).equals(" ुआ")) {
word.delete(len - 1, len + 1);
return;
}
if (word.substring(len-1, len+1).equals(" ुओ")) {
word.delete(len - 1, len + 1);
return;
}
if (word.substring(len- 1, len+1).equals("ये")) {
word.delete(len-1 , len + 1);
return;
}
if (word.substring(len-1, len+1).equals(" ेन")) {
word.delete(len - 1, len + 1);
return;
}
if (word.substring(len-1, len+1).equals(" ेण")) {
word.delete(len - 1, len + 1);
return;
}
if (word.substring(len- 1, len+1).equals(" ीय")) {
word.delete(len-1 , len + 1);
return;
}
if (word.substring(len-1, len+1).equals("टी")) {
word.delete(len - 1, len + 1);
return;
}
if (word.substring(len-1, len+1).equals("ार")) {
word.delete(len - 1, len + 1);
return;
}
if (word.substring(len-1, len+1).equals("ाई")) {
word.delete(len - 1, len + 1);
return;
}
} /* end if len > 3 */
if (len > 2) {
if (word.substring(len, len+1).equals(" ा")) {
word.delete(len , len + 1);
return;
}
if (word.substring(len, len+1).equals(" े")) {
word.delete(len , len + 1);
return;
}
if (word.substring(len, len+1).equals(" ी")) {
word.delete(len , len + 1);
return;
}
if (word.substring(len, len+1).equals(" ो")) {
word.delete(len , len + 1);
return;
}
if (word.substring(len, len+1).equals("ि ")) {
word.delete(len , len + 1);
return;
}
if (word.substring(len, len+1).equals("अ")) {
word.delete(len , len + 1);
return;
}
} /* end if len > 2 */
return;
}
}
- 1. 尋找印度尼西亞語言詞幹程序員
- 2. 是否有可用於NSSpeechSynthesizer Cocoa類的任何語言綁定?
- 3. ElasticSearch使用多種詞幹語言
- 4. 是否有任何第三方工具可用於在Python中執行詞幹
- 5. 語言爲印度語言的android api
- 6. TTS印度語言
- 7. 有沒有關於H7語言的任何信息?
- 8. Rails是否有porter stemmer(英語詞幹)?
- 9. 是否有任何功能語言沒有垃圾回收
- 10. 是否有可能使任何語言可執行?
- 11. 獲取任何語言的所有維基詞典的意義
- 12. 是否有任何處理莎士比亞英語的Lucene詞幹?
- 13. 是否有一種通用的查詢語言,用於獨立於編程語言的任意集?
- 14. 使用ElasticSearch的Haystack中的多語言詞幹
- 15. 無法將英文單詞翻譯爲印度地區語言
- 16. 多語言全文:應該使用哪種詞幹[雪球]語言?
- 17. 沒有語言運行時的基於JVM的語言
- 18. 有沒有用於拼寫單詞的任何算法?
- 19. 文本到語音語言環境印地語印度語
- 20. 是否有任何不是上下文無關語言的正規語言?
- 21. 是否有可用於其他語言的TFS的API?
- 22. 如何用任何可能的語言預先匹配一組單詞?
- 23. 使用Javascript(沒有任何其他語言)的實時日曆
- 24. 通用編程語言沒有堆是可行的嗎?
- 25. 什麼是可用於Jenkins CI的所有腳本語言?
- 26. 是否有靜態類型的語言可用於JVM和CLR?
- 27. 如何使用to_tsvector與沒有字典(沒有詞幹)?
- 28. 是否有類似於可用於任何語言的「終極」反編譯器的軟件?
- 29. 有沒有辦法讓任何語言的「鬼光標」?
- 30. 所有印度語言的自定義字體用Facebook api
您可以更新鏈接,您provided.thanks – 2015-03-04 05:58:32