如何从POS标记文件中提取名词单词 [英] how to extract noun words from POS tagged file
问题描述
hi
我想从用urdu语言编写的文件中提取名词。这是POS标记文件。因此,对于每个单词,附加标签,如< NN>。 ,< P>我想用< NN>提取单词。标签
文件是:
گڑھی< PN>شاہو< PN>پل< PN>پر< P>ڈور< NN>سے< SE>ہلاک< ADJ>ہونے< VB>والے< WALA>ناصر< PN>کے< P>بارے< NN>میں< P> 22℃; CA>
$ b $双向我正在使用C#.Net,代码是:
var re = new Regex(@\d + \。\\\ + + \ + +(。*? )\ + +< nn>);
foreach(在re.Matches中匹配m(textBox1.Text))
textBox2 .Text = textBox2.Text ++ m.Groups [1] .Value
请帮助我。
试试这个:
string input = گڑھی< PN>شاہو< PN>پل< PN>< P>ڈور< NN>سے< SE>ہلاک< ADJ>ہونے< VB>والے< WALA>ناص رLT&; PN>کے< P>بارے< NN>میں< P> 22℃; CA>中跨度>;
var matches = Regex.Matches(input, @ (([^<>] +)≤([^>] +)>)跨度>);
foreach ( var m 在匹配)
{
// m.Groups [0]和m .Groups [1]有每个term:گڑھی< PN>
// m .Groups [2]有urdu:گڑھی
// m.Groups [3]有POS值:PN
}
编辑:马特
< pre lang =c#> var 名词= matches.Cast<匹配>()。其中(m = > m.Groups [ 3 ]。值== NN跨度>);
hi
i want to extract noun words from my file written in urdu language. this is POS tagged file. so with each word a tag is attached like <NN> , <P> i want to extract word with <NN> tag
file is:
گڑھی<PN>شاہو<PN>پل<PN>پر<P>ڈور<NN>سے<SE>ہلاک<ADJ>ہونے<VB>والے<WALA>ناصر<PN>کے<P>بارے<NN>میں<P>22<CA>
i am using C#.Net and the code is:
var re = new Regex(@"\d+\.\d+\s+(.*?)\s+ <nn>");
foreach (Match m in re.Matches(textBox1.Text))
textBox2.Text = textBox2.Text + " " + m.Groups[1].Value
plese help me.
Try this:
string input = "گڑھی<PN>شاہو<PN>پل<PN>پر<P>ڈور<NN>سے<SE>ہلاک<ADJ>ہونے<VB>والے<WALA>ناصر<PN>کے<P>بارے<NN>میں<P>22<CA>"; var matches = Regex.Matches(input, @"(([^<>]+)<([^>]+)>)"); foreach (var m in matches) { // m.Groups[0] and m.Groups[1] have each "term": گڑھی<PN> // m.Groups[2] has the urdu: گڑھی // m.Groups[3] has the POS value: PN }
Edit: Matt
var nouns = matches.Cast<Match>().Where(m => m.Groups[3].Value == "NN");
这篇关于如何从POS标记文件中提取名词单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!