如何从POS标记文件中提取名词单词 [英] how to extract noun words from POS tagged file

查看:121
本文介绍了如何从POS标记文件中提取名词单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆