<div dir="ltr">Stefan,<br><br>Thank you very much! (again)!<br><br>Where can I find some documentation on this? So I won&#39;t bother you ;)<br><br>Eva<br><br><br><br><div class="gmail_quote">On Mon, Sep 6, 2010 at 5:08 PM, Stefan Evert <span dir="ltr">&lt;<a href="mailto:stefanML@collocations.de" target="_blank">stefanML@collocations.de</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>&gt; I&#39;m trying to use the Perl API for version 3.0 and I have encountered a problem:<br>




&gt;<br>
&gt; The &quot;system commands&quot; (such as show corpora, choosing a corpus to use and so on) work fine and I can receive their output (using getline or the output of exec method);<br>
&gt; however, running  a query (no matter how simple it is and no matter how many results I get when running it from the CQP command line), I get nothing from the API methods.<br>
<br>
</div>The Perl interface runs CQP in a special mode as a backend process.  One of the consequences is that the results of a query are no longer displayed automatically -- you have to run a &quot;cat&quot; command explicitly.<br>




<br>
The &quot;standard&quot; way of running queries in CWB::CQP is the following:<br>
<br>
        $cqp = new CWB::CQP;  # or whatever initialisation you need<br>
        # activate your corpus etc.<br>
<br>
        $cqp-&gt;exec(&quot;Matches = &lt;your query&gt;&quot;);<br>
        ($n_matches) = $cqp-&gt;exec(&quot;size Matches&quot;);<br>
        # now you can skip processing if there are 0 matches, or &quot;reduce Matches&quot; if there are too many<br>
        @lines = $cqp-&gt;exec(&quot;cat Matches&quot;); # or use &quot;tabulate&quot; to get exactly the information you need<br>
<br>
        # somewhat slower but more memory-efficient for large result sets:<br>
        $cqp-&gt;run(&quot;cat Matches&quot;);<br>
        while (defined $line = $cqp-&gt;getline) {<br>
                # process this result line<br>
        }<br>
<br>
If you want to see interactively what this special mode looks like, run CQP as follows:<br>
<br>
        cqp -c  # -c = &quot;child process mode&quot;<br>
        set PrettyPrint off;<br>
<br>
Note that there are no input prompts or command-line editing facilities in this mode.<br>
<br>
Best,<br>
Stefan<br>
<br>
_______________________________________________<br>
CWB mailing list<br>
<a href="mailto:CWB@sslmit.unibo.it" target="_blank">CWB@sslmit.unibo.it</a><br>
<a href="http://devel.sslmit.unibo.it/mailman/listinfo/cwb" target="_blank">http://devel.sslmit.unibo.it/mailman/listinfo/cwb</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Eva Kelman<br><br>Ph.D. Student,<br>Interdisciplinary Center for Neural Computation, Jerusalem<br>
</div>