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.
590 lines
25 KiB
HTML
590 lines
25 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>pattern-fr</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-fr" class="noexternal" target="_blank">http://www.clips.ua.ac.be/pages/pattern-fr</a></div>
|
|
<h1>pattern.fr</h1>
|
|
<!-- Parsed from the online documentation. -->
|
|
<div id="node-1697" class="node node-type-page"><div class="node-inner">
|
|
<div class="content">
|
|
<p><span class="big">The pattern.fr module contains a fast part-of-speech tagger for French (identifies nouns, adjectives, verbs, etc. in a sentence), sentiment analysis, and tools for French 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_fr.gif" alt="" /></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 French nouns there is <span class="inline_code">singularize()</span> and <span class="inline_code">pluralize()</span>. The implementation uses a statistical approach with 93% accuracy for singularization and 92% for pluralization.</p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.fr import singularize, pluralize
|
|
>>>
|
|
>>> print singularize('chats')
|
|
>>> print pluralize('chat')
|
|
|
|
chat
|
|
chats </pre></div>
|
|
<h3>Verb conjugation</h3>
|
|
<p>For French 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 1,750 common French verbs (constructed with Bob Salita's verb conjugation rules). For unknown verbs it will fall back to regular expressions with an accuracy of about 83%. </p>
|
|
<p>French 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> tense, the <span class="inline_code">IMPERATIVE</span>, <span class="inline_code">CONDITIONAL</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.fr import conjugate
|
|
>>> from pattern.fr import INFINITIVE, PRESENT, PAST, SG, SUBJUNCTIVE, PERFECTIVE
|
|
>>>
|
|
>>> print conjugate('suis', INFINITIVE)
|
|
>>> print conjugate('suis', PRESENT, 1, SG, mood=SUBJUNCTIVE)
|
|
>>> print conjugate('suis', PAST, 3, SG)
|
|
>>> print conjugate('suis', PAST, 3, SG, aspect=PERFECTIVE)
|
|
|
|
être
|
|
sois
|
|
était
|
|
fut </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> (<em>passé simple</em>). 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> (<em>imparfait</em>):</p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.fr import conjugate
|
|
>>> from pattern.fr import IMPERFECT, PRETERITE
|
|
>>>
|
|
>>> print conjugate('suis', IMPERFECT, 3, SG)
|
|
>>> print conjugate('suis', PRETERITE, 3, SG)
|
|
|
|
était
|
|
fut </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>être</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>je <span style="text-decoration: underline;">suis</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>tu <span style="text-decoration: underline;">es</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>il <span style="text-decoration: underline;">est</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>nous <span style="text-decoration: underline;">sommes</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>vous <span style="text-decoration: underline;">êtes</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>ils <span style="text-decoration: underline;">sont</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>étant</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>sois</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">IMPERATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1pl!"</td>
|
|
<td><em>soyons</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>soyez</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">CONDITIONAL</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1sg->"</td>
|
|
<td><em>je <span style="text-decoration: underline;">serais</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">CONDITIONAL</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2sg->"</td>
|
|
<td><em>tu <span style="text-decoration: underline;">serais</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">CONDITIONAL</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sg->"</td>
|
|
<td><em>il <span style="text-decoration: underline;">serait</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">CONDITIONAL</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1pl->"</td>
|
|
<td><em>nous <span style="text-decoration: underline;">serions</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">CONDITIONAL</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2pl->"</td>
|
|
<td><em>vous <span style="text-decoration: underline;">seriez</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">CONDITIONAL</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3pl->"</td>
|
|
<td><em>ils <span style="text-decoration: underline;">seraient</span></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>je <span style="text-decoration: underline;">sois</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>tu <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">SG</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sg?"</td>
|
|
<td><em>il <span style="text-decoration: underline;">soit</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>nous <span style="text-decoration: underline;">soyons</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>vous <span style="text-decoration: underline;">soyez</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>ils <span style="text-decoration: underline;">soient</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>j' <span style="text-decoration: underline;">étais</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>tu <span style="text-decoration: underline;">étais</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>il <span style="text-decoration: underline;">était</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>nous <span style="text-decoration: underline;">étions</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>vous <span style="text-decoration: underline;">étiez</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>ils <span style="text-decoration: underline;">étaient</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>été</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>je <span style="text-decoration: underline;">fus</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>tu <span style="text-decoration: underline;">fus</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>il <span style="text-decoration: underline;">fut</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>nous <span style="text-decoration: underline;">fûmes</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>vous <span style="text-decoration: underline;">fûtes</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>ils <span style="text-decoration: underline;">furent</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>je <span style="text-decoration: underline;">fusse</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>tu <span style="text-decoration: underline;">fusses</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>il <span style="text-decoration: underline;">fût</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>nous <span style="text-decoration: underline;">fussions</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>vous <span style="text-decoration: underline;">fussiez</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>ils <span style="text-decoration: underline;">fussent</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>je <span style="text-decoration: underline;">serai</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>tu <span style="text-decoration: underline;">seras</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>il <span style="text-decoration: underline;">sera</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>nous <span style="text-decoration: underline;">serons</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>vous <span style="text-decoration: underline;">serez</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>ils <span style="text-decoration: underline;">seron</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>: Salita, B. (2011). <em>French Verb Conjugation Rules</em>. Retrieved from: </span><span><a class="noexternal" style="color: inherit;" href="http://fvcr.sourceforge.net/" target="_blank">http://fvcr.sourceforge.net</a>.</span></p>
|
|
<h3>Attributive & predicative adjectives </h3>
|
|
<p>French adjectives inflect with an <span class="inline_code">-e</span>, <span class="inline_code">-s</span> or <span class="inline_code">-es</span> suffix depending on gender. There are many irregular cases (e.g., <em>curieux</em> → <em>une fille curieuse</em>). You can get the base form with the <span class="inline_code">predicative()</span> function. A statistical approach is used with an accuracy of 95%.</p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.fr import predicative
|
|
>>> print predicative('curieuse')
|
|
|
|
curieux </pre></div>
|
|
<h3>Sentiment analysis</h3>
|
|
<p class="example">For opinion mining there is <span class="inline_code">sentiment()</span>, which returns a (<span class="inline_code">polarity</span>, <span class="inline_code">subjectivity</span>)-tuple, based on a lexicon of adjectives. Polarity is a value between <span class="inline_code">-1.0</span> and <span class="inline_code">+1.0</span>, subjectivity between <span class="inline_code">0.0</span> and <span class="inline_code">1.0</span>. The accuracy is around 74% (P 0.77, R 0.73) for book reviews:</p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.fr import sentiment
|
|
>>> print sentiment('Un livre magnifique!')
|
|
|
|
(1.0, 1.0) </pre></div>
|
|
<h3>Parser</h3>
|
|
<p>For parsing there is <span class="inline_code">parse()</span>, <span class="inline_code">parsetree()</span> and <span class="inline_code">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.fr import parse, split
|
|
>>>
|
|
>>> s = parse(u"Le chat noir s'était assis sur le tapis.")
|
|
>>> for sentence in split(s):
|
|
>>> print sentence
|
|
|
|
Sentence('Le/DT/B-NP/O chat/NN/I-NP/O noir/JJ/I-NP/O'
|
|
"s'/PRP/B-NP/O était/VB/B-VP/O assis/VBN/I-VP/O"
|
|
'sur/IN/B-PP/B-PNP le/DT/B-NP/I-PNP tapis/NN/I-NP/I-PNP ././O/O')
|
|
</pre></div>
|
|
<p>The parser is based on <a href="http://alpage.inria.fr/~sagot/lefff-en.html">Le<em>fff</em></a>. For words in Le<em>fff</em> that can have multiple part-of-speech tags, we used <a href="http://www.lexique.org/">Lexique</a> to find the most frequent POS-tag. </p>
|
|
<p class="small"><span style="text-decoration: underline;">References</span>: </p>
|
|
<p class="small">Sagot, B. (2010). The Le<em>fff</em>, a freely available and large-coverage morphological and syntantic lexicon for French. <em>Proceedings of LREC'10</em>.</p>
|
|
<p class="small">New, B., Pallier, C., Ferrand, L. & Matos, R. (2001). A lexical database for contemporary french: LEXIQUE. <em>L'année Psychologique</em>. </p>
|
|
</div>
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
SyntaxHighlighter.all();
|
|
</script>
|
|
</body>
|
|
</html> |