1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
|
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.16: http://docutils.sourceforge.net/" />
<title>Stemming Algorithms</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="stemming-algorithms">
<h1 class="title">Stemming Algorithms</h1>
<p>Xapian uses the <a class="reference external" href="https://snowballstem.org/">Snowball Stemming
Algorithms</a>. At present, these support
Armenian, Basque, Catalan, Danish, Dutch, English, Finnish, French, German,
Hungarian, Italian, Norwegian, Portuguese, Romanian, Russian, Spanish, Swedish,
and Turkish.</p>
<p>There are also implementations of Lovins' English stemmer, Porter's
original English stemmer, the Kraaij-Pohlmann Dutch stemmer, and a
variation of the German stemmer which normalises umlauts.</p>
<p>We'd like to add stemmers for more languages - see the Snowball site for
information on how to contribute.</p>
<div class="section" id="what-is-a-stemming-algorithm">
<h1>What is a stemming algorithm?</h1>
<p>A stemming algorithm is a process of linguistic normalisation, in which
the variant forms of a word are reduced to a common form, for example,</p>
<pre class="literal-block">
connection
connections
connective ---> connect
connected
connecting
</pre>
<p>It is important to appreciate that we use stemming with the intention of
improving the performance of IR systems. It is not an exercise in
etymology or grammar. In fact from an etymological or grammatical
viewpoint, a stemming algorithm is liable to make many mistakes. In
addition, stemming algorithms - at least the ones presented here - are
applicable to the written, not the spoken, form of the language.</p>
<p>For some of the world's languages, Chinese for example, the concept of
stemming is not applicable, but it is certainly meaningful for the many
languages of the Indo-European group. In these languages words tend to
be constant at the front, and to vary at the end:</p>
<pre class="literal-block">
-ion
-ions
connect-ive
-ed
-ing
</pre>
<p>The variable part is the <cite>ending</cite>, or <cite>suffix</cite>. Taking these endings
off is called <cite>suffix stripping</cite> or <cite>stemming</cite>, and the residual part
is called the stem.</p>
</div>
<div class="section" id="endings">
<h1>Endings</h1>
<p>Another way of looking at endings and suffixes is to think of the suffix
as being made up of a number of endings. For example, the French word</p>
<pre class="literal-block">
confirmatives
</pre>
<p>can be thought of as <cite>confirm</cite> with a chain of endings,</p>
<pre class="literal-block">
-atif (adjectival ending - morphological)
plus -e (feminine ending - grammatical)
plus -s (plural ending - grammatical)
</pre>
<p>-atif can also be thought of as -ate plus -if. Note that the addition of
endings can cause respellings, so -e changes preceding <cite>f</cite> to <cite>v</cite>.</p>
<p>Endings fall into two classes, grammatical and morphological. The
addition of -s in English to make a plural is an example of a
grammatical ending. The word remains of the same type. There is usually
only one dictionary entry for a word with all its various grammatical
endings. Morphological endings create new types of word. In English -ise
or -ize makes verbs from nouns (<cite>demon</cite>, <cite>demonise</cite>), -ly makes
adverbs from adjectives (<cite>foolish</cite>, <cite>foolishly</cite>), and so on. Usually
there are separate dictionary endings for these creations.</p>
</div>
<div class="section" id="language-knowledge">
<h1>Language knowledge</h1>
<p>It is much easier to write a stemming algorithm for a language when you
are familiar with it. If you are not, you will probably need to work
with someone who is, and who can also explain details of grammar to you.
Best is a professional teacher or translator. You certainly don't need
to have a world authority on the grammar of the language. In fact too
much expertise can get in the way when it comes to the very practical
matter of writing the stemming algorithm.</p>
</div>
<div class="section" id="vocabularies">
<h1>Vocabularies</h1>
<p>Each stemmer is issued with a vocabulary in data/voc.txt, and its
stemmed form in data/voc.st. You can use these for testing and
evaluation purposes.</p>
</div>
<div class="section" id="raw-materials">
<h1>Raw materials</h1>
<p>A conventional grammar of a language will list all the grammatical
endings, and will often summarise most of the morphological endings. A
grammar, plus a dictionary, are therefore basic references in the
development of a stemming algorithm, although you can dispense with them
if you have an excellent knowledge of the language. What you cannot
dispense with is a vocabulary to try the algorithm out on as it is being
developed. Assemble about 2 megabytes of text. A mix of sources is best,
and literary prose (conventional novels) usually gives an ideal mix of
tenses, cases, persons, genders etc. Obviously the texts should be in
some sense 'contemporary', but it is an error to exclude anything
slightly old. The algorithm itself may well get applied to older texts
once it has been written. For English, the works of Shakespeare in the
customary modern spelling make a good test vocabulary.</p>
<p>From the source text derive a control vocabulary of words in sorted
order. Sample vocabularies in this style are part of our Open Source
release. If you make a small change to the stemming algorithm you should
have a procedure that presents the change as a three column table:
column one is the control vocabulary, column 2 the stemmed equivalent,
and column 3 the stemmed equivalent after the change has been made to
the algorithm. The effects of the change can be evaluated by looking at
the differences between columns two and three.</p>
<p>The first job is to come up with a list of endings. This can be done by
referring to the grammar, the dictionary, and also by browsing through
the control vocabulary.</p>
</div>
<div class="section" id="rules-for-removing-endings">
<h1>Rules for removing endings</h1>
<p>If a word has an ending, E, when should E be removed? Various criteria
come into play here. One is the knowledge we have about the word from
other endings that might have been removed. If a word ends with a
grammatical verb ending, and that has been removed, then we have a verb
form, and the only further endings to consider are morphological endings
that create verbs from other word types. At this level the system of
endings gives rise to a small state table, which can be followed in
devising the algorithm. In Latin derived languages, there is a state
table of morphological endings that roughly looks like this:</p>
<pre class="literal-block">
-IC (adj) -+-> -ATION (noun)
+-> -ITY (noun)
+-> -MENT (adv)
\-> -AT (verb) -+-> -IV (adj) -+-> -ITY (noun)
| \-> -MENT (adv)
\-> -OR (noun)
-ABLE (adj) -+-> -ITY (noun)
\-> -MENT (adv)
-OUS (adj) ---> -MENT (adv)
</pre>
<p>The ending forms take different values in different languages. In
French, -OR becomes <cite>-eur</cite> (m.) or <cite>-rice</cite> (f.), -AT disappears into
the infinitive form of a verb. In English, -MENT becomes <cite>-ly</cite>, and
then one can recognise,</p>
<pre class="literal-block">
-IC-ATION fortification
-IC-ITY electricity
-IC-MENT fantastically
-AT-IV contemplative
-AT-OR conspirator
-IV-ITY relativity
-IV-MENT instinctively
-ABLE-ITY incapability
-ABLE-MENT charitably
-OUS-MENT famously
</pre>
<p>Trios, -IC-AT-IV etc., also occur, but sequences of length four,
-IC-AT-IV-ITY and -IC-AT-IV-MENT, are absent (or occur very rarely).</p>
<p>Sometimes the validity of an ending depends on the immediately preceding
group of letters. In Italian, for example, certain pronouns and pronoun
groups attach to present participle and infinitive forms of verbs, for
example,</p>
<pre class="literal-block">
scrivendole = scrivendo (writing) + le (to her)
mandarglielo = mandare (to give) + glielo (it to him)
</pre>
<p>If E is the ending, the possible forms are -andoE, -endoE, -arE, -erE,
-irE, so E is removed in the context -Xndo or Yr, where X is a or e, and
Y is a or e or i. See the <tt class="docutils literal">attached_pronoun</tt> procedure in the Italian
stemmer.</p>
<p>The most useful criterion for removing an ending, however, is to base
the decision on the syllable length of the stem that will remain. This
idea was first used in the English stemming algorithm, and has been
found to be applicable in the other stemming algorithms too. If C stands
for a sequence of consonants, and V for a sequence of vowels, any word
can be analysed as,</p>
<pre class="literal-block">
[C] V C ... V C [V]
</pre>
<p>where [..] indicates arbitrary presence, and V C ... V C means V C
repeated zero or more times. We can find successive positions 0, 1, 2
... in a word corresponding to each vowel-consonant stretch V C,</p>
<pre class="literal-block">
t h u n d e r s t r i c k e n
0 1 2 3 4
</pre>
<p>The closer E is to the beginning of the word, the more unwilling we
should be remove it. So we might have a rule to remove E if at is after
position 2, and so on.</p>
</div>
<div class="section" id="developing-the-algorithm">
<h1>Developing the algorithm</h1>
<p>Build the algorithm up bit by bit, trying out a small number of ending
removals at a time. For each new ending plus rule added, decide whether,
on average, the stemming process is improved or degraded. If it is
degraded the rule is unhelpful and can be discarded.</p>
<p>This sounds like common sense, but it is actually very easy to fall into
the trap of endlessly elaborating the rules without looking at their
true effect. What you find eventually is that you can be improving
performance in one area of the vocabulary, while causing a similar
degradation of performance in another area. When this happens
consistently it is time to call a halt to development and to regard the
stemming algorithm as finished.</p>
<p>It is important to realise that the stemming process cannot be made
perfect. For example, in French, the simple verb endings -ons and -ent
of the present tense occur repeatedly in other contexts. -ons is the
plural form of all nouns ending -on, and -ent is also a common noun
ending. On balance it is best not to remove these endings. In practice
this affects -ent verb endings more than -ons verb endings, since -ent
endings are commoner. The result is that verbs stem not to a single
form, but to a much smaller number of forms (three), among which the
form given by the true stem of the verb is by far the commonest.</p>
<p>If we define errors A and B by,</p>
<ul class="simple">
<li>error A: removing an ending when it is not an ending</li>
<li>error B: not removing an ending when it is an ending</li>
</ul>
<p>Then removing -ent leads to error A; not removing -ent leads to error B.
We must adopt the rule that minimises the number of errors - not the
rule that appears to be the most elegant.</p>
</div>
<div class="section" id="irregular-forms">
<h1>Irregular forms</h1>
<p>Linguistic irregularities slip through the net of a stemming algorithm.
The English stemmer stems <cite>cows</cite> to <cite>cow</cite>, but does not stem <cite>oxen</cite>
to <cite>ox</cite>. In reality this matters much less than one might suppose. In
English, the irregular plurals tend to be of things that were common in
Anglo-Saxon England: oxen, sheep, mice, dice - and lice. Men, women and
children are of course common today, but the very commonness of these
words makes them of less importance in IR systems. Similar remarks may
be said about irregular verbs in English, the total number of which is
around 150. Here, the fact that verbs are used perhaps rather less than
nouns and adjectives in IR queries helps account for the unimportance of
verb irregularities in IR performance. There are in English more
significant irregularities in morphological changes such as <cite>receive</cite>
to <cite>reception</cite>, <cite>decide</cite> to <cite>decision</cite> etc., which correspond,
ultimately, to irregularities in the Latin verbs from which these words
derive. But again working IR systems are rarely upset by lack of
resolution of these forms.</p>
<p>An irregularity of English which does cause a problem is the word
<cite>news</cite>. It is now a singular noun, and is never regarded as the plural
of <cite>new</cite>. This, and a few more howlers, are placed in a table,
<tt class="docutils literal">irregular_forms</tt>, in the English stemming algorithm. Similar tables
are provided in the other stemming algorithms, with some provisional
entries. The non-English stemming algorithms have not been used enough
for a significant list of irregular forms to emerge, but as they do,
they can be placed in the <tt class="docutils literal">irregular_forms</tt> table.</p>
</div>
<div class="section" id="using-stemming-in-ir">
<h1>Using stemming in IR</h1>
<p>In earlier implementations of IR systems, the words of a text were
usually stemmed as part of the indexing process, and the stemmed forms
only held in the main IR index. The words of each incoming query would
then be stemmed similarly. When the index terms were seen by the user,
for example during query expansion, they would be seen in their stemmed
form. It was important therefore that the stemmed form of a word should
not be too unfamiliar in appearance. A user will be comfortable with
seeing <cite>apprehend</cite>, which stands for <cite>apprehending</cite>, <cite>apprehended</cite> as
well as <cite>apprehend</cite>. More problematical is <cite>apprehens</cite>, standing for
<cite>apprehension</cite>, <cite>apprehensive</cite> etc., but even so, a trained user would
not have a problem with this. In fact all the Xapian stemming algorithms
are built on the assumption that it leave stemmed forms which it would
not be embarrassing to show to real users, and we suggest that new
stemming algorithms are designed with this criterion in mind.</p>
<p>A superior approach is to keep each word, <em>W</em>, and its stemmed form,
<em>s(W)</em>, as a two-way relation in the IR system. <em>W</em> is held in the index
with its own posting list. <em>s(W)</em> could have its separate posting list,
but this would be derivable from the class of words that stem to <em>s(W)</em>.
The important thing is to have the <em>W</em> ↔ <em>s(W)</em> relation. From <em>W</em> we
can derive <em>s(W)</em>, the stemmed form. From a stemmed form <em>s(W)</em> we can
derive <em>W</em> plus the other words in the IR system which stem to <em>s(W)</em>.
Any word can then be searched on either stemmed or unstemmed. If the
stemmed form of a word needs to be shown to the user, it can be
represented by the commonest among the words which stem to that form.</p>
</div>
<div class="section" id="stopwords">
<h1>Stopwords</h1>
<p>It has been traditional in setting up IR systems to discard the very
commonest words of a language - the stopwords - during indexing. A more
modern approach is to index everything, which greatly assists searching
for phrases for example. Stopwords can then still be eliminated from the
query as an optional style of retrieval. In either case, a list of
stopwords for a language is useful.</p>
<p>Getting a list of stopwords can be done by sorting a vocabulary of a
text corpus for a language by frequency, and going down the list picking
off words to be discarded.</p>
<p>The stopword list connects in various ways with the stemming algorithm:</p>
<p>The stemming algorithm can itself be used to detect and remove
stopwords. One would add into the <tt class="docutils literal">irregular_forms</tt> table something
like this,</p>
<pre class="literal-block">
"", /* null string */
"am/is/are/be/being/been/" /* BE */
"have/has/having/had/" /* HAD */
"do/does/doing/did/" /* DID */
... /* multi-line string */
</pre>
<p>so that the words <cite>am</cite>, <cite>is</cite> etc. map to the null string (or some
other easily recognised value).</p>
<p>Alternatively, stopwords could be removed before the stemming algorithm
is applied, or after the stemming algorithm is applied. In this latter
case, the words to be removed must themselves have gone through the
stemmer, and the number of distinct forms will be greatly reduced as a
result. In Italian for example, the four forms</p>
<pre class="literal-block">
questa queste questi questo
</pre>
<p>(meaning <cite>that</cite>) all stem to</p>
<pre class="literal-block">
quest
</pre>
<!-- FIXME: Nice idea, but currently these lists are fictitious:
In the xapian-data directory in the git repository, each language
represented in the stemming section has, in addition to a large test
vocabulary, a useful stopword list in both source and stemmed form. The
source form, in the file ``stopsource``, is carefully annotated, and the
derived file, ``stopwords``, contains an equivalent list of sorted,
stemmed, stopwords. -->
</div>
</div>
</body>
</html>
|