|
|
<!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 & pluralization.</span></p>
|
|
|
<p>It can be used by itself or with other <a href="pattern.html">pattern</a> modules: <a href="pattern-web.html">web</a> | <a href="pattern-db.html">db</a> | <a href="pattern-en.html">en</a> | <a href="pattern-search.html">search</a> | <a href="pattern-vector.html">vector</a> | <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. </p>
|
|
|
<h3>Noun singularization & pluralization</h3>
|
|
|
<p>For Spanish nouns there is <span class="inline_code">singularize()</span> and <span class="inline_code">pluralize()</span>. 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;">>>> from pattern.es import singularize, pluralize
|
|
|
>>>
|
|
|
>>> print singularize('gatos')
|
|
|
>>> 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>. 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%. </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 <span class="inline_code">FUTURE</span> and <span class="inline_code">CONDITIONAL</span> tense, the <span class="inline_code">IMPERATIVE</span> and <span class="inline_code">SUBJUNCTIVE</span> mood and the <span class="inline_code">PERFECTIVE</span> aspect:</p>
|
|
|
<div class="example">
|
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.es import conjugate
|
|
|
>>> from pattern.es import INFINITIVE, PRESENT, PAST, SG, SUBJUNCTIVE, PERFECTIVE
|
|
|
>>>
|
|
|
>>> print conjugate('soy', INFINITIVE)
|
|
|
>>> print conjugate('soy', PRESENT, 1, SG, mood=SUBJUNCTIVE)
|
|
|
>>> print conjugate('soy', PAST, 3, SG)
|
|
|
>>> print conjugate('soy', PAST, 3, SG, aspect=PERFECTIVE)
|
|
|
|
|
|
ser
|
|
|
sea
|
|
|
era
|
|
|
fue </pre></div>
|
|
|
<p>For <span class="inline_code">PAST</span> tense + <span class="inline_code">PERFECTIVE</span> aspect we can also use <span class="inline_code">PRETERITE</span>. For <span class="inline_code">PAST</span> tense + <span class="inline_code">IMPERFECTIVE</span> aspect we can also use <span class="inline_code">IMPERFECT</span>:</p>
|
|
|
<div class="example">
|
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.es import conjugate
|
|
|
>>> from pattern.es import IMPERFECT, PRETERITE
|
|
|
>>>
|
|
|
>>> print conjugate('soy', IMPERFECT, 3, SG)
|
|
|
>>> print conjugate('soy', PRETERITE, 3, SG)
|
|
|
|
|
|
era
|
|
|
fue </pre></div>
|
|
|
<p> 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 <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>tú <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 <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 <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 <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 <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;"> </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>sé</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;"> </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 <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>tú <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 <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 <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 <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 <span style="text-decoration: underline;">sean</span></em></td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </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 <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>tú <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 <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 <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 <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 <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;"> </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 <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>tú <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 <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 <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 <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 <span style="text-decoration: underline;">fueron</span></em></td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </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 <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>tú <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 <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 <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 <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 <span style="text-decoration: underline;">fueran</span></em></td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </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 <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>tú <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 <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 <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 <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 <span style="text-decoration: underline;">serán</span></em></td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </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->"</td>
|
|
|
<td><em>yo <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->"</td>
|
|
|
<td><em>tú <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->"</td>
|
|
|
<td><em>el <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->"</td>
|
|
|
<td><em>nosotros <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->"</td>
|
|
|
<td><em>vosotros <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->"</td>
|
|
|
<td><em>ellos <span style="text-decoration: underline;">serían</span></em></td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
<p>Instead of optional parameters, a single short alias, or <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). <em>Spanish Verb Forms</em>. Retrieved from: </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 & predicative adjectives </h3>
|
|
|
<p>Spanish adjectives inflect with an <span class="inline_code">-o</span>, <span class="inline_code">-a</span> , <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> → <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 <span class="inline_code">attributive()</span>. 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> and/or <span class="inline_code">PLURAL</span>).</p>
|
|
|
<div class="example">
|
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.es import attributive, predicative
|
|
|
>>> from pattern.es import FEMALE, PLURAL
|
|
|
>>>
|
|
|
>>> print predicative('curiosos')
|
|
|
>>> print attributive('curioso', gender=FEMALE)
|
|
|
>>> 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 <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> (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> → <span class="inline_code">Sentence</span> → <span class="inline_code">Chunk</span> → <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>. See the <span class="inline_code">pattern.en</span> documentation (<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> objects. </p>
|
|
|
<div class="example">
|
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.es import parse, split
|
|
|
>>>
|
|
|
>>> s = parse('El gato negro se sienta en la estera.')
|
|
|
>>> for sentence in split(s):
|
|
|
>>> 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> using 1.5M words from the tagged sections 10,000–15,000. The accuracy is around 92%. The original <a href="http://www.lsi.upc.edu/~nlp/SVMTool/parole.html" target="_blank">Parole</a> 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 <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>: Reese, S., Boleda, G., Cuadros, M., Padró, L., Rigau, G (2010). <br />Wikicorpus: A Word-Sense Disambiguated Multilingual Wikipedia Corpus. <em>Proceedings of LREC'10</em>. </p>
|
|
|
<h3>Sentiment analysis</h3>
|
|
|
<p>There's no <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> |