Stanford.NLP.NET icon indicating copy to clipboard operation
Stanford.NLP.NET copied to clipboard

StanfordCoreNLP.annotate will hang with some input text.

Open zxli opened this issue 10 years ago • 0 comments

Here is how StanfordCoreNLP is initialized.

        // Annotation pipeline configuration
        var props = new Properties();
        props.setProperty("annotators", "tokenize, ssplit, pos, parse, sentiment");
        props.setProperty("sutime.binders", "0");

        // Make sure the model files are extracted to the current directory from the .jar file.
        var nlp = new StanfordCoreNLP(props);
        Annotation annotation = new Annotation(text);         
        nlp.annotate(annotation);

The following (long) text input will hang StanfordCoreNLP.annotate call.

Process Start in Azure Website ramiramilu&#39 s answer is actually not correct You can run any exe you want ([check this for example](https://github com/projectkudu/kudu/wiki/Kudu-console)) The problem you are hitting is not in running an exe it&#39 s something specific to wkhtml2pdf exe itself That exe uses a bunch of GDI+ calls on Windows for rendering the PDF and that is what&#39 s not allowed in Azure Websites sandbox (the GDI+ calls not running an exe)

Using a WebJob won&#39 t help either because WebJobs run in the same context as the site which means under the same sandbox

Edit:

There is nothing special to how you would launch an external process on Azure Websites than how you would do it normally with C# Again the problem you are facing is with wkhtml2pdf exe and not with the general concept of launching a process

Here is a sample that you can try that launches cmd exe and reads what is written on stdout

var processStartInfo = new ProcessStartInfo()
{
    Arguments = &quot /c echo \&quot test\&quot &quot  
    FileName = @&quot c:\windows\system32\cmd exe&quot  
    RedirectStandardOutput = true 
    UseShellExecute = false
} 

var process = Process Start(processStartInfo) 

using (var streamReader = new StreamReader(process StandardOutput BaseStream))
{
    ViewBag MessageFromExe = streamReader ReadToEnd() 
}

ViewBag MessageFromExe will have the value &quot test&quot you can verify that on your view and you can run that just fine in Azure Websites

zxli avatar Aug 06 '15 04:08 zxli