2018-06-11 22:44
浏览 153


I am using the tool for language analysis called Freeling. For language identification I use the analyzer command in the Linux console:

analyzer -f /usr/share/freeling/config/ident.cfg --outlv ident --fidn /usr/share/freeling/common/lang_ident/ident.dat

When I execute this command, its wait for the text entries (sentences) and determine what language they are in. When I write a line of text in Spanish: "la casa es azul" and I press the enter key returns ES which means that it is written in Spanish. If I write "the house is blue" it returns EN, for the English language. To interrupt its execution press Ctrl + C.

When I execute this command in the Linux console the first sentence takes some time to respond and the other times responds quickly.

I use this code to execute this php command but it takes many seconds to return the result:

$cmd = "analyzer -f /usr/share/freeling/config/ident.cfg --outlv ident --fidn /usr/share/freeling/common/lang_ident/ident.dat";

$descriptorspec = array(
    0 => array("pipe", "r"),
    1 => array("pipe", "w"),
    2 => array("pipe", "w"),

$process = proc_open($cmd, $descriptorspec, $pipes);

$oracion[0]="we are the word";
$oracion[1]="somos el mundo";

if (is_resource($process)) {

    fwrite($pipes[0], $oracion[0]);
    fwrite($pipes[0], $oracion[1]);

    while($pdf_content = fgets($pipes[1]))
    echo $pdf_content . "<br>";
    $return_value = proc_close($process);


How can I improve the response time?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题