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.

115 lines
5.5 KiB
HTML

5 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-shell</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-shell" class="noexternal" target="_blank">http://www.clips.ua.ac.be/pages/pattern-shell</a></div>
<h1>pattern.shell</h1>
<!-- Parsed from the online documentation. -->
<div id="node-1400" class="node node-type-page"><div class="node-inner">
<div class="content">
<h2>pattern.en parser</h2>
<p>The English parser can be invoked from the command-line.&nbsp;The&nbsp;<a href="pattern.html">pattern</a> module should be installed (i.e., located in <span class="inline_code">/site-packages</span>, see installation instructions) or the current working directory should be the one that contains the <span class="inline_code">pattern</span> folder.</p>
<pre class="brush:python; gutter:false; light:true;">&gt; python -m pattern.en -f file.txt</pre><p><span>If no options are given a full parse is executed (i.e. tokenization, tagging, chunking, relations and lemmata). Otherwise, you need to explicitly list every required option:</span></p>
<table class="border">
<tbody>
<tr>
<td><span class="inline_code">-O</span></td>
<td><span class="inline_code">--tokenize</span></td>
<td>Tokenize the input.</td>
</tr>
<tr>
<td><span class="inline_code">-T&nbsp;</span></td>
<td><span class="inline_code">--tags&nbsp;</span></td>
<td>Parse part-of-speech tags.</td>
</tr>
<tr>
<td><span class="inline_code">-C</span>&nbsp;</td>
<td><span class="inline_code">--chunks&nbsp;</span></td>
<td>Parse chunks and <span class="postag">PNP</span> tags.&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-R</span>&nbsp;</td>
<td><span class="inline_code">--relations</span>&nbsp;</td>
<td>Parse verb/predicate relations.&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-L</span>&nbsp;</td>
<td><span class="inline_code">--lemmata&nbsp;</span></td>
<td>Parse lemmata (<em>was</em><em>be</em>).&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-f&nbsp;</span></td>
<td><span class="inline_code">--file</span>&nbsp;</td>
<td>Input file path.&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-s&nbsp;</span></td>
<td><span class="inline_code">--string&nbsp;</span></td>
<td>Input string.&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-e</span>&nbsp;</td>
<td><span class="inline_code">--encoding</span>&nbsp;</td>
<td>Specify character encoding (utf-8 by default).&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-v&nbsp;</span></td>
<td class="inline_code">--version</td>
<td>Print current version of Pattern.</td>
</tr>
</tbody>
</table>
<p>Short options can be concatenated. Also note the <span class="inline_code">xml</span> option which produces XML output:</p>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.en xml -OT -s 'The black cat sat on the mat.'</pre></div>
<h3><span>pattern.es | de | fr | it | nl parsers</span></h3>
<p><span>The parsers for other languages work in the same way. Note the <span class="inline_code">xml</span> option (produces XML output).</span></p>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.es -s 'El gato negro se sienta en la estera.'</pre></div>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.de -s 'Die schwarze Katze liegt auf der Matte.'</pre></div>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.fr -s "Le chat noir s'était assis sur le tapis."</pre></div>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.it -s 'Il gatto nero faceva le fusa.'</pre></div>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.nl -s 'De zwarte kat zat op de mat.'</pre></div>
</div>
</div></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
SyntaxHighlighter.all();
</script>
</body>
</html>