如何根据单词从段落中选择一个作品 [英] how to select an sentance from the paragraph based on the word

查看:87
本文介绍了如何根据单词从段落中选择一个作品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



首先,如果你解决了我的问题,你会感激...



描述:



我有开发窗口应用程序来编辑xml内容。现在我的问题是,如何根据单词从段落中选择一个句子。我们需要选择段落中存在单词的句子。



要在下面的例子中清楚,我们需要在段落标签内容中找到商店。然后选择句子在哪里商店存在。



是否可以使用正则表达式概念?怎么样?





例如:



Dear friends,

First You will be thankful if u solved my problem...

Description:

I have developing window application for editing xml content.now my problem was,how to select an sentence from paragraph based on a word.we need to select an sentence where the word exist from paragraph.

To be clear in the below example,we need to find the store in the paragraph tag content.then select the sentence where the store exist.

is it possible using regular expression concept?how?


Eg:

<keyword>store</keyword>
<paragraph>mystery customer. Buckley continues to order Rasaratnam to hand over the cash and tells other customers to leave the store. Stick-up! Armed raider is overpowered in shop From Page One The dramatic CCTV footage shows shopworker Rasaratnam being ordered to put his hands on the counter, but he refuses to </paragraph >

推荐答案

为什么不使用字符串''<$将段落拆分成句子c $ c>在上拆分。(句点/句号)。然后从split-ed数组中逐个检查每个句子中的单词,并使用包含单词的单词并丢弃其余单词。
Why not split the paragraph into sentences using string''s split function on .(period/full stop). Then check for the word in each sentence one by one from the split-ed array and use the ones that contains the word and throw away the rest.


这篇关于如何根据单词从段落中选择一个作品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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