如何用R码找出句子中的连词。
例如:
下面提到了一个句子,它是以下内容的输出
sentence <- text[grep("Guarantee of",text)]请提交13,863.00卢比/-(13,000,863卢比)的履约保证
现在我需要得到"Rs.13,863.00/-"的的连续词“的保证”
-Thanks
发布于 2015-06-17 11:40:12
sentence <- 'You are requested to submit the Performance Guarantee of Rs.13,863.00/-( Rupees thirteen thousand and eight sixty three)';
sub('.*Guarantee\\s+of\\s+([a-zA-Z0-9,._/-]+).*','\\1',sentence);
## [1] "Rs.13,863.00/-"发布于 2015-06-17 11:42:05
试一试
gsub('.*Guarantee of\\s*|\\(.*', '', str1)
[1] "Rs.13,863.00/-"或
library(stringr)
str_extract(str1, '(?:Rs.)[^(]+')
#[1] "Rs.13,863.00/-"数据
str1 <- "You are requested to submit the Performance Guarantee of Rs.13,863.00/-( Rupees thirteen thousand and eight sixty three)"https://stackoverflow.com/questions/30890432
复制相似问题