- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经使用树标记器来找出文本文件的言辞和词干,现在我需要读取每个单词的词干输出(位于下面显示的输出文件的第三列中)。如何去做?如何跳过两栏并阅读第三栏?
the DT the
girls NNS girl
own VVP own
paper## JJ paper##
vol## JJ vol##
viii## NN viii##
no## NN no##
357## JJ 357##
october NN October
30 CD @card@
1886## JJ 1886##
price NN price
one CD one
penny## NN penny##
as IN as
the DT the
baron NN baron
had VHD have
conjectured VVN conjecture
the DT the
housemaid NN housemaid
whom WP whom
he PP he
had VHD have
called VVN call
out RP out
of IN of
the DT the
nursery NN nursery
to TO to
look VV look
for## JJ for##
lons NNS lons
cane NN cane
on IN on
finding VVG find
her PP$ her
master NN master
had VHD have
gone VVN go
without IN without
it PP it
did VVD do
not RB not
hurry VV hurry
back RB back
but CC but
stopped VVN stop
talking## NN talking##
to TO to
some DT some
of IN of
the DT the
other JJ other
servants NNS servant
for IN for
perhaps RB perhaps
a DT a
quarter NN quarter
of IN of
an DT an
hour NN hour
when WRB when
she PP she
returned VVD return
to TO to
the DT the
nursery## NN nursery##
and CC and
to TO to
her PP$ her
amazement NN amazement
found VVD find
the DT the
baby NN baby
was VBD be
gone## JJ gone##
she PP she
was VBD be
not RB not
alarmed VVN alarm
at IN at
first JJ first
except IN except
she PP she
supposed## JJ supposed##
she PP she
should MD should
get VV get
a DT a
scolding NN scolding
from IN from
the DT the
nurse NN nurse
who WP who
she PP she
imagined VVD imagine
had VHD have
come VVN come
in IN in
and CC and
taken VVN take
the DT the
child## NN child##
to TO to
another DT another
room NN room
however RB however
having VHG have
the DT the
excellent JJ excellent
excuse NN excuse
that IN/that that
her PP$ her
master NN master
had VHD have
called VVN call
her PP$ her
away RB away
she## NN she##
went VVD go
in IN in
search NN search
of IN of
the DT the
nurse NN nurse
but CC but
now RB now
not RB not
finding VVG find
her PP her
anywhere RB anywhere
and CC and
hearing VVG hear
from IN from
the DT the
footman## NN footman##
that IN/that that
she PP she
was VBD be
not RB not
expected VVN expect
back RB back
till IN till
very RB very
late JJ late
marie NN marie
became VVD become
seriously RB seriously
alarmed## JJ alarmed##
perhaps RB perhaps
madame NN madame
has VHZ have
taken VVN take
it PP it
into IN into
her PP$ her
room NN room
she PP she
might MD might
have VH have
heard VVN hear
it PP it
crying VVG cry
and CC and
fetched VVD fetch
it## NN it##
suggested VVD suggest
the DT the
footman NN footman
and CC and
marie NN marie
very RB very
much RB much
against IN against
her PP her
will MD will
felt VVD feel
she PP she
was VBD be
in IN in
duty NN duty
bound VVN bind
to## JJ to##
go NN go
and CC and
see## NN see##
so IN so
knocking VVG knock
at IN at
her PP$ her
mistresss NP mistresss
door NN door
she PP she
called VVD call
out RP out
madame NN madame
has VHZ have
she PP she
taken VVN take
the DT the
baby## NN baby##
the DT the
poor JJ poor
little JJ little
baroness NN baroness
who WP who
was VBD be
asleep RB asleep
started VVN start
up RP up
and CC and
called VVD call
to TO to
the DT the
servant NN servant
to TO to
come VV come
in## JJ in##
madame NN madame
has VHZ have
she PP she
the DT the
baby NN baby
repeated VVD repeat
the DT the
girl## NN girl##
the DT the
baby NN baby
no DT no
what WP what
do VVP do
you PP you
mean VV mean
where WRB where
is VBZ be
it PP it
and CC and
where WRB where
is VBZ be
nurse NN nurse
cried VVD cry
the DT the
baroness NN baroness
jumping## NN jumping##
up RB up
and CC and
slipping VVG slip
on IN on
a DT a
dressinggown NN dressinggown
and CC and
slippers## NN slippers##
marie NN marie
began VVD begin
to TO to
cry VV cry
and CC and
to TO to
pour VV pour
forth RB forth
such PDT such
a DT a
volley NN volley
of IN of
words NNS word
excuses NNS excuse
fears VVZ fear
alarms NNS alarm
and CC and
wonders## NN wonders##
that IN/that that
the DT the
baroness NN baroness
could MD could
make VV make
out RP out
nothing NN nothing
and CC and
rushed VVD rush
to TO to
the DT the
nursery NN nursery
to TO to
see VV see
for IN for
herself PP herself
what## NN what##
had VHD have
happened## NN happened##
the DT the
empty JJ empty
cradle NN cradle
did VVD do
not RB not
however RB however
throw VV throw
much RB much
light JJ light
upon IN upon
it PP it
and CC and
the DT the
servants## NN servants##
who WP who
answered VVD answer
the DT the
bell NN bell
which WDT which
the DT the
baroness NN baroness
clashed VVD clash
wildly RB wildly
looked VVN look
as IN as
scared VVN scare
as IN as
the DT the
sobbing VVG sob
marie## NN marie##
to TO to
find VV find
the DT the
baby NN baby
had VHD have
disappeared## NN disappeared##
a DT a
search NN search
from IN from
attic NN attic
to TO to
basement NN basement
was VBD be
at IN at
once RB once
instituted VVN institute
the## JJ the##
menservants NNS manservant
were VBD be
sent VVN send
into IN into
the DT the
grounds NNS ground
with IN with
lanterns NNS lantern
the DT the
whole JJ whole
house NN house
was VBD be
turned VVN turn
topsyturvy## NN topsyturvy##
in IN in
the DT the
midst NN midst
of IN of
which WDT which
the DT the
nurse NN nurse
returned VVD return
and CC and
finding VVG find
her PP$ her
baby NN baby
was VBD be
gone VVN go
went VVD go
into IN into
violent## JJ violent##
hysterics NNS hysteric
while IN while
the DT the
young JJ young
baroness NN baroness
with IN with
flying VVG fly
hair NN hair
and CC and
dilated VVN dilate
eyes NNS eye
rushed VVN rush
about IN about
wringing## NN wringing##
her PP$ her
hands NNS hand
and CC and
looking VVG look
as IN as
she PP she
felt VVD feel
distracted VVN distract
with IN with
grief## NN grief##
the DT the
search NN search
was VBD be
of IN of
course NN course
in IN in
vain JJ vain
and CC and
they PP they
were VBD be
just RB just
coming VVG come
to TO to
the DT the
conclusion NN conclusion
that IN/that that
the DT the
baby## NN baby##
had VHD have
been VBN be
stolen VVN steal
when WRB when
the DT the
baron NN baron
returned VVN return
from IN from
seeing VVG see
lon NN lon
off## NN off##
the DT the
moment NN moment
the DT the
baroness NN baroness
heard VVD hear
his PP$ his
voice NN voice
in IN in
the DT the
hall NN hall
she PP she
flew VVD fly
down RP down
the DT the
wide JJ wide
oak NN oak
staircase NN staircase
crying## NN crying##
arnaud NN arnaud
arnaud NN arnaud
my PP$ my
precious JJ precious
baby NN baby
is VBZ be
gone VVN go
it PP it
is VBZ be
stolen JJ stolen
find VV find
her PP her
find VV find
her PP her
or CC or
i NP i
shall MD shall
go## JJ go##
mad## NN mad##
and CC and
a DT a
glance NN glance
at IN at
her PP$ her
wild JJ wild
eyes NNS eye
almost RB almost
testified VVD testify
she PP she
spoke VVD speak
the DT the
truth## NN truth##
she PP she
is VBZ be
not RB not
stolen VVN steal
she PP she
is VBZ be
safe JJ safe
enough RB enough
said VVD say
the DT the
baron NN baron
sulkily## NN sulkily##
最佳答案
假设您想要每行的第三个标记,其中标记之间用空格分隔,您可以按如下方式进行:
BufferedReder
)String#split
)split方法返回一个字符串数组,第三部分是array[2]
split 方法采用正则表达式作为参数和可选限制,如果 positiv 告诉您希望应用该模式的次数。
用于按空格分割的正则表达式是 \s+
。
如果您希望数组中最多有 3
个元素,则传递限制 3
,如果正则表达式可以应用 3 次,那么最后一个元素将包含所有字符串的其余部分。
以下是如何使用split方法:
@Test
public void split3() {
String[] array = "the DT the".split("\\s+", 3);
System.out.println(array[2]);
array = "the DT the foo bar".split("\\s+", 3);
// last element will contain all the rest of the string.
System.out.println(array[2]);
array = "the DT".split("\\s+", 3);
System.out.println(array[2]); // java.lang.ArrayIndexOutOfBoundsException: 2
array = "the DT".split("\\s+");
System.out.println(array[2]); // java.lang.ArrayIndexOutOfBoundsException: 2
array = "the DT the foo bar".split("\\s+");
System.out.println(array[2]);
}
输出为:
the
> will cause java.lang.ArrayIndexOutOfBoundsException: 2
> will cause java.lang.ArrayIndexOutOfBoundsException: 2
the foo bar
the
为了避免 ArrayIndexOutOfBoundsException
的影响,请在尝试访问第三个元素之前始终检查结果数组的长度:
array = "the DT the".split("\\s+");
if(array.length > 2) {
System.out.println(array[2]);
} else {
// there is no 3rd column
}
关于java - 使用java读取txt文件的特定部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19675808/
今天我在一个 Java 应用程序中看到了几种不同的加载文件的方法。 文件:/ 文件:// 文件:/// 这三个 URL 开头有什么区别?使用它们的首选方式是什么? 非常感谢 斯特凡 最佳答案 file
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我有一个 javascript 文件,并且在该方法中有一个“测试”方法,我喜欢调用 C# 函数。 c# 函数与 javascript 文件不在同一文件中。 它位于 .cs 文件中。那么我该如何管理 j
需要检查我使用的文件/目录的权限 //filePath = path of file/directory access denied by user ( in windows ) File fil
我在一个目录中有很多 java 文件,我想在我的 Intellij 项目中使用它。但是我不想每次开始一个新项目时都将 java 文件复制到我的项目中。 我知道我可以在 Visual Studio 和
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我有 3 个组件的 Twig 文件: 文件 1: {# content-here #} 文件 2: {{ title-here }} {# content-here #}
我得到了 mod_ldap.c 和 mod_authnz_ldap.c 文件。我需要使用 Linux 命令的 mod_ldap.so 和 mod_authnz_ldap.so 文件。 最佳答案 从 c
我想使用PIE在我的项目中使用 IE7。 但是我不明白的是,我只能在网络服务器上使用 .htc 文件吗? 我可以在没有网络服务器的情况下通过浏览器加载的本地页面中使用它吗? 我在 PIE 的文档中看到
我在 CI 管道中考虑这一点,我应该首先构建和测试我的应用程序,结果应该是一个 docker 镜像。 我想知道使用构建环境在构建服务器上构建然后运行测试是否更常见。也许为此使用构建脚本。最后只需将 j
using namespace std; struct WebSites { string siteName; int rank; string getSiteName() {
我是 Linux 新手,目前正在尝试使用 ginkgo USB-CAN 接口(interface) 的 API 编程功能。为了使用 C++ 对 API 进行编程,他们提供了库文件,其中包含三个带有 .
我刚学C语言,在实现一个程序时遇到了问题将 test.txt 文件作为程序的输入。 test.txt 文件的内容是: 1 30 30 40 50 60 2 40 30 50 60 60 3 30 20
如何连接两个tcpdump文件,使一个流量在文件中出现一个接一个?具体来说,我想“乘以”一个 tcpdump 文件,这样所有的 session 将一个接一个地按顺序重复几次。 最佳答案 mergeca
我有一个名为 input.MP4 的文件,它已损坏。它来自闭路电视摄像机。我什么都试过了,ffmpeg , VLC 转换,没有运气。但是,我使用了 mediainfo和 exiftool并提取以下信息
我想做什么? 我想提取 ISO 文件并编辑其中的文件,然后将其重新打包回 ISO 文件。 (正如你已经读过的) 我为什么要这样做? 我想开始修改 PSP ISO,为此我必须使用游戏资源、 Assets
给定一个 gzip 文件 Z,如果我将其解压缩为 Z',有什么办法可以重新压缩它以恢复完全相同的 gzip 文件 Z?在粗略阅读了 DEFLATE 格式后,我猜不会,因为任何给定的文件都可能在 DEF
我必须从数据库向我的邮件 ID 发送一封带有附件的邮件。 EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Adventure Works Admin
我有一个大的 M4B 文件和一个 CUE 文件。我想将其拆分为多个 M4B 文件,或将其拆分为多个 MP3 文件(以前首选)。 我想在命令行中执行此操作(OS X,但如果需要可以使用 Linux),而
快速提问。我有一个没有实现文件的类的项目。 然后在 AppDelegate 我有: #import "AppDelegate.h" #import "SomeClass.h" @interface A
我是一名优秀的程序员,十分优秀!