You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

579 lines
25 KiB
HTML

4 years ago
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>pattern-es</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../clips.css" />
<style>
/* Small fixes because we omit the online layout.css. */
h3 { line-height: 1.3em; }
#page { margin-left: auto; margin-right: auto; }
#header, #header-inner { height: 175px; }
#header { border-bottom: 1px solid #C6D4DD; }
table { border-collapse: collapse; }
#checksum { display: none; }
</style>
<link href="../js/shCore.css" rel="stylesheet" type="text/css" />
<link href="../js/shThemeDefault.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../js/shCore.js"></script>
<script language="javascript" src="../js/shBrushXml.js"></script>
<script language="javascript" src="../js/shBrushJScript.js"></script>
<script language="javascript" src="../js/shBrushPython.js"></script>
</head>
<body class="node-type-page one-sidebar sidebar-right section-pages">
<div id="page">
<div id="page-inner">
<div id="header"><div id="header-inner"></div></div>
<div id="content">
<div id="content-inner">
<div class="node node-type-page"
<div class="node-inner">
<div class="breadcrumb">View online at: <a href="http://www.clips.ua.ac.be/pages/pattern-es" class="noexternal" target="_blank">http://www.clips.ua.ac.be/pages/pattern-es</a></div>
<h1>pattern.es</h1>
<!-- Parsed from the online documentation. -->
<div id="node-1626" class="node node-type-page"><div class="node-inner">
<div class="content">
<p><span class="big">The pattern.es module contains a fast part-of-speech tagger for Spanish (identifies nouns, adjectives, verbs, etc. in a sentence) and tools for Spanish verb conjugation and noun singularization &amp; pluralization.</span></p>
<p>It can be used by itself or with other&nbsp;<a href="pattern.html">pattern</a>&nbsp;modules:&nbsp;<a href="pattern-web.html">web</a>&nbsp;|&nbsp;<a href="pattern-db.html">db</a>&nbsp;| <a href="pattern-en.html">en</a>&nbsp;|&nbsp;<a href="pattern-search.html">search</a>&nbsp;|&nbsp;<a href="pattern-vector.html">vector</a>&nbsp;|&nbsp;<a href="pattern-graph.html">graph</a>.</p>
<p><img src="../g/pattern_schema_es.gif" alt="" width="620" height="180" /></p>
<hr />
<h2>Documentation</h2>
<p>The functions in this module take the same parameters and return the same values as their counterparts in <a href="pattern-en.html">pattern.en</a>. Refer to the documentation there for more details.&nbsp;&nbsp;</p>
<h3>Noun singularization &amp; pluralization</h3>
<p>For Spanish nouns there is <span class="inline_code">singularize()</span> and <span class="inline_code">pluralize()</span>.&nbsp;The implementation is slightly less robust than the English version (accuracy 94% for singularization and 78% for pluralization).</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.es import singularize, pluralize
&gt;&gt;&gt;
&gt;&gt;&gt; print singularize('gatos')
&gt;&gt;&gt; print pluralize('gato')
gato
gatos </pre></div>
<h3>Verb conjugation</h3>
<p>For Spanish verbs there is <span class="inline_code">conjugate()</span>, <span class="inline_code">lemma()</span>, <span class="inline_code">lexeme()</span> and <span class="inline_code">tenses()</span>.&nbsp;The lexicon for verb conjugation contains about 600 common Spanish verbs, composed by Fred Jehle. For unknown verbs it will fall back to a rule-based approach with an accuracy of about 84%.&nbsp;</p>
<p>Spanish verbs have more tenses than English verbs. In particular, the plural differs for each person, and there are additional forms for the&nbsp;<span class="inline_code">FUTURE</span>&nbsp;and&nbsp;<span class="inline_code">CONDITIONAL</span>&nbsp;tense, the&nbsp;<span class="inline_code">IMPERATIVE</span>&nbsp;and&nbsp;<span class="inline_code">SUBJUNCTIVE</span>&nbsp;mood and the&nbsp;<span class="inline_code">PERFECTIVE</span>&nbsp;aspect:</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.es import conjugate
&gt;&gt;&gt; from pattern.es import INFINITIVE, PRESENT, PAST, SG, SUBJUNCTIVE, PERFECTIVE
&gt;&gt;&gt;
&gt;&gt;&gt; print conjugate('soy', INFINITIVE)
&gt;&gt;&gt; print conjugate('soy', PRESENT, 1, SG, mood=SUBJUNCTIVE)
&gt;&gt;&gt; print conjugate('soy', PAST, 3, SG)
&gt;&gt;&gt; print conjugate('soy', PAST, 3, SG, aspect=PERFECTIVE)
ser
sea
era
fue </pre></div>
<p>For <span class="inline_code">PAST</span>&nbsp;tense + <span class="inline_code">PERFECTIVE</span>&nbsp;aspect we can also use <span class="inline_code">PRETERITE</span>. For <span class="inline_code">PAST</span>&nbsp;tense + <span class="inline_code">IMPERFECTIVE</span>&nbsp;aspect we can also use <span class="inline_code">IMPERFECT</span>:</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.es import conjugate
&gt;&gt;&gt; from pattern.es import IMPERFECT, PRETERITE
&gt;&gt;&gt;
&gt;&gt;&gt; print conjugate('soy', IMPERFECT, 3, SG)
&gt;&gt;&gt; print conjugate('soy', PRETERITE, 3, SG)
era
fue </pre></div>
<p>&nbsp;The <span class="inline_code">conjugate()</span> function takes the following optional parameters:</p>
<table class="border">
<tbody>
<tr>
<td class="smallcaps">Tense</td>
<td class="smallcaps">Person</td>
<td class="smallcaps">Number</td>
<td class="smallcaps">Mood</td>
<td class="smallcaps">Aspect</td>
<td class="smallcaps">Alias</td>
<td class="smallcaps">Example</td>
</tr>
<tr>
<td class="inline_code">INFINITVE</td>
<td class="inline_code">None</td>
<td class="inline_code">None</td>
<td class="inline_code">None</td>
<td class="inline_code">None</td>
<td class="inline_code">"inf"</td>
<td><em>ser</em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">1</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1sg"</td>
<td><em>yo&nbsp;<span style="text-decoration: underline;">soy</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">2</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2sg"</td>
<td><em>&nbsp;<span style="text-decoration: underline;">eres</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">3</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3sg"</td>
<td><em>el&nbsp;<span style="text-decoration: underline;">es</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">1</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1pl"</td>
<td><em>nosotros&nbsp;<span style="text-decoration: underline;">somos</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">2</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2pl"</td>
<td><em>vosotros&nbsp;<span style="text-decoration: underline;">sois</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">3</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3pl"</td>
<td><em>ellos&nbsp;<span style="text-decoration: underline;">son</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">None</td>
<td class="inline_code">None</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">PROGRESSIVE</td>
<td class="inline_code">"part"</td>
<td><em>siendo</em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">2</td>
<td class="inline_code">SG</td>
<td class="inline_code">IMPERATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2sg!"</td>
<td><em></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">2</td>
<td class="inline_code">PL</td>
<td class="inline_code">IMPERATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2pl!"</td>
<td><em>sed</em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">1</td>
<td class="inline_code">SG</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1sg?"</td>
<td><em>yo&nbsp;<span style="text-decoration: underline;">sea</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">2</td>
<td class="inline_code">SG</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2sg?"</td>
<td><em>&nbsp;<span style="text-decoration: underline;">seas</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">3</td>
<td class="inline_code">SG</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3sg?"</td>
<td><em>el&nbsp;<span style="text-decoration: underline;">sea</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">1</td>
<td class="inline_code">PL</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1pl?"</td>
<td><em>nosotros&nbsp;<span style="text-decoration: underline;">seamos</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">2</td>
<td class="inline_code">PL</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2pl?"</td>
<td><em>vosotros&nbsp;<span style="text-decoration: underline;">seáis</span></em></td>
</tr>
<tr>
<td class="inline_code">PRESENT</td>
<td class="inline_code">3</td>
<td class="inline_code">PL</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3pl?"</td>
<td><em>ellos&nbsp;<span style="text-decoration: underline;">sean</span></em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">1</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1sgp"</td>
<td><em>yo&nbsp;<span style="text-decoration: underline;">era</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">2</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2sgp"</td>
<td><em>&nbsp;<span style="text-decoration: underline;">eras</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">3</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3sgp"</td>
<td><em>el&nbsp;<span style="text-decoration: underline;">era</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">1</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1ppl"</td>
<td><em>nosotros&nbsp;<span style="text-decoration: underline;">éramos</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">2</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2ppl"</td>
<td><em>vosotros&nbsp;<span style="text-decoration: underline;">erais</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">3</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3ppl"</td>
<td><em>ellos&nbsp;<span style="text-decoration: underline;">eran</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">None</td>
<td class="inline_code">None</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">PROGRESSIVE</td>
<td class="inline_code">"ppart"</td>
<td><em>sido</em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">1</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">PERFECTIVE</td>
<td class="inline_code">"1sgp+"</td>
<td><em>yo&nbsp;<span style="text-decoration: underline;">fui</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">2</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">PERFECTIVE</td>
<td class="inline_code">"2sgp+"</td>
<td><em>&nbsp;<span style="text-decoration: underline;">fuiste</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">3</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">PERFECTIVE</td>
<td class="inline_code">"3sgp+"</td>
<td><em>el&nbsp;<span style="text-decoration: underline;">fue</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">1</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">PERFECTIVE</td>
<td class="inline_code">"1ppl+"</td>
<td><em>nosotros&nbsp;<span style="text-decoration: underline;">fuimos</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">2</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">PERFECTIVE</td>
<td class="inline_code">"2ppl+"</td>
<td><em>vosotros&nbsp;<span style="text-decoration: underline;">fuisteis</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">3</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">PERFECTIVE</td>
<td class="inline_code">"3ppl+"</td>
<td><em>ellos&nbsp;<span style="text-decoration: underline;">fueron</span></em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">1</td>
<td class="inline_code">SG</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1sgp?"</td>
<td><em>yo&nbsp;<span style="text-decoration: underline;">fuera</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">2</td>
<td class="inline_code">SG</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2sgp?"</td>
<td><em>&nbsp;<span style="text-decoration: underline;">fueras</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">3</td>
<td class="inline_code">SG</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3sgp?"</td>
<td><em>el&nbsp;<span style="text-decoration: underline;">fuera</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">1</td>
<td class="inline_code">PL</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1ppl?"</td>
<td><em>nosotros&nbsp;<span style="text-decoration: underline;">fuéramos</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">2</td>
<td class="inline_code">PL</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2ppl?"</td>
<td><em>vosotros&nbsp;<span style="text-decoration: underline;">fuerais</span></em></td>
</tr>
<tr>
<td class="inline_code">PAST</td>
<td class="inline_code">3</td>
<td class="inline_code">PL</td>
<td class="inline_code">SUBJUNCTIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3ppl?"</td>
<td><em>ellos&nbsp;<span style="text-decoration: underline;">fueran</span></em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</td>
</tr>
<tr>
<td class="inline_code">FUTURE</td>
<td class="inline_code">1</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1sgf"</td>
<td><em>yo&nbsp;<span style="text-decoration: underline;">seré</span></em></td>
</tr>
<tr>
<td class="inline_code">FUTURE</td>
<td class="inline_code">2</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2sgf"</td>
<td><em>&nbsp;<span style="text-decoration: underline;">serás</span></em></td>
</tr>
<tr>
<td class="inline_code">FUTURE</td>
<td class="inline_code">3</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3sgf"</td>
<td><em>el&nbsp;<span style="text-decoration: underline;">será</span></em></td>
</tr>
<tr>
<td class="inline_code">FUTURE</td>
<td class="inline_code">1</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1plf"</td>
<td><em>nosotros&nbsp;<span style="text-decoration: underline;">seremos</span></em></td>
</tr>
<tr>
<td class="inline_code">FUTURE</td>
<td class="inline_code">2</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2plf"</td>
<td><em>vosotros&nbsp;<span style="text-decoration: underline;">seréis</span></em></td>
</tr>
<tr>
<td class="inline_code">FUTURE</td>
<td class="inline_code">3</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3plf"</td>
<td><em>ellos&nbsp;<span style="text-decoration: underline;">serán</span></em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</td>
</tr>
<tr>
<td class="inline_code">CONDITIONAL</td>
<td class="inline_code">1</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1sg-&gt;"</td>
<td><em>yo&nbsp;<span style="text-decoration: underline;">sería</span></em></td>
</tr>
<tr>
<td class="inline_code">CONDITIONAL</td>
<td class="inline_code">2</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2sg-&gt;"</td>
<td><em>&nbsp;<span style="text-decoration: underline;">serías</span></em></td>
</tr>
<tr>
<td class="inline_code">CONDITIONAL</td>
<td class="inline_code">3</td>
<td class="inline_code">SG</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3sg-&gt;"</td>
<td><em>el&nbsp;<span style="text-decoration: underline;">sería</span></em></td>
</tr>
<tr>
<td class="inline_code">CONDITIONAL</td>
<td class="inline_code">1</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1pl-&gt;"</td>
<td><em>nosotros&nbsp;<span style="text-decoration: underline;">seríamos</span></em></td>
</tr>
<tr>
<td class="inline_code">CONDITIONAL</td>
<td class="inline_code">2</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2pl-&gt;"</td>
<td><em>vosotros&nbsp;<span style="text-decoration: underline;">seríais</span></em></td>
</tr>
<tr>
<td class="inline_code">CONDITIONAL</td>
<td class="inline_code">3</td>
<td class="inline_code">PL</td>
<td class="inline_code">INDICATIVE</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3pl-&gt;"</td>
<td><em>ellos&nbsp;<span style="text-decoration: underline;">serían</span></em></td>
</tr>
</tbody>
</table>
<p>Instead of optional parameters, a single short alias, or&nbsp;<span class="inline_code">PARTICIPLE</span> or <span class="inline_code">PAST+PARTICIPLE</span> can also be given. With no parameters, the infinitive form of the verb is returned.</p>
<p class="small"><span style="text-decoration: underline;">Reference</span><span>: Jehle, F. (2012).&nbsp;<em>Spanish Verb Forms</em>. Retrieved from:&nbsp;</span><span><a class="noexternal" style="color: inherit;" href="http://users.ipfw.edu/jehle/verblist.htm" target="_blank">http://users.ipfw.edu/jehle/verblist.htm</a>.</span></p>
<h3>Attributive &amp; predicative adjectives&nbsp;</h3>
<p>Spanish adjectives inflect with an <span class="inline_code">-o</span>,&nbsp;<span class="inline_code">-a</span>&nbsp;, <span class="inline_code">-os</span>, <span class="inline_code">-as</span>, or <span class="inline_code">-es</span> suffix (e.g., <em>curioso</em>&nbsp;<em>los gatos curiosos</em>) depending on gender. You can get the base form with the <span class="inline_code">predicative()</span> function, or vice versa with&nbsp;<span class="inline_code">attributive()</span>.&nbsp;For predicative, a statistical approach is used with an accuracy of 93%. For attributive, you need to supply gender (<span class="inline_code">MALE</span>, <span class="inline_code">FEMALE</span>, <span class="inline_code">NEUTRAL</span>&nbsp;and/or <span class="inline_code">PLURAL</span>).</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.es import attributive, predicative
&gt;&gt;&gt; from pattern.es import FEMALE, PLURAL
&gt;&gt;&gt;
&gt;&gt;&gt; print predicative('curiosos')
&gt;&gt;&gt; print attributive('curioso', gender=FEMALE)
&gt;&gt;&gt; print attributive('curioso', gender=FEMALE+PLURAL)
curioso
curiosa
curiosas </pre></div>
<h3>Parser</h3>
<p>For parsing there is <span class="inline_code" style="font-family: Courier, monospace; font-size: 12px;">parse()</span>, <span class="inline_code">parsetree()</span> and&nbsp;<span class="inline_code" style="font-family: Courier, monospace; font-size: 12px;">split()</span>. The <span class="inline_code">parse()</span> function annotates words in the given string with their part-of-speech <a class="link-maintenance" href="mbsp-tags.html">tags</a>&nbsp;(e.g., <span class="postag">NN</span> for nouns and <span class="postag">VB</span> for verbs). The <span class="inline_code">parsetree()</span> function takes a string and returns a tree of nested objects (<span class="inline_code">Text</span>&nbsp;<span class="inline_code">Sentence</span>&nbsp;<span class="inline_code">Chunk</span>&nbsp;<span class="inline_code">Word</span>). The <span class="inline_code">split()</span> function takes the output of <span class="inline_code">parse()</span> and returns a <span class="inline_code">Text</span>.&nbsp;See the <span class="inline_code">pattern.en</span> documentation&nbsp;(<span class="link-maintenance" style="color: #78aaff;"><a style="color: #8caaff; outline-style: none !important; outline-width: initial !important; outline-color: initial !important;" href="pattern-en.html#tree">here</a></span>) how to manipulate <span class="inline_code">Text</span>&nbsp;objects.&nbsp;</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.es import parse, split
&gt;&gt;&gt;
&gt;&gt;&gt; s = parse('El gato negro se sienta en la estera.')
&gt;&gt;&gt; for sentence in split(s):
&gt;&gt;&gt; print sentence
Sentence('El/DT/B-NP/O gato/NN/I-NP/O negro/JJ/I-NP/O'
'se/PRP/B-NP/O sienta/VB/B-VP/O'
'en/IN/B-PP/B-PNP la/DT/B-NP/I-PNP estera/NN/I-NP/I-PNP ././O/O')</pre></div>
<p>The parser is trained on the Spanish portion of <a href="http://www.lsi.upc.edu/~nlp/wikicorpus/" target="_blank">Wikicorpus </a>&nbsp;using 1.5M words from the tagged sections 10,00015,000. The accuracy is around 92%.&nbsp;The original <a href="http://www.lsi.upc.edu/~nlp/SVMTool/parole.html" target="_blank">Parole</a>&nbsp;tagset is mapped to <a href="mbsp-tags.html">Penn Treebank</a> tagset. If you need to work with the original tags you can also use&nbsp;<span class="inline_code">parse()</span> with an optional parameter <span class="inline_code">tagset="parole"</span>.</p>
<p class="small"><span style="text-decoration: underline;">Reference</span>:&nbsp;Reese, S., Boleda, G., Cuadros, M., Padró, L., Rigau, G (2010).&nbsp;<br />Wikicorpus: A Word-Sense Disambiguated Multilingual Wikipedia Corpus.&nbsp;<em>Proceedings of LREC'10</em>.&nbsp;</p>
<h3>Sentiment analysis</h3>
<p>There's no&nbsp;<span class="inline_code">sentiment()</span> function for Spanish yet.</p>
</div>
</div></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
SyntaxHighlighter.all();
</script>
</body>
</html>