-
Notifications
You must be signed in to change notification settings - Fork 229
Closed
Description
###I am trying to run a Python script with Spacy NER model on C# using Dynamic Py.
- I used following C# source code:
using System;
using IronPython.Hosting;
using System.Collections.Generic;
using System.Text;
namespace PythonTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Python integrieren");
Console.ReadLine();
var engine = Python.CreateEngine();
try
{
engine.ExecuteFile(@"C:\Users\Admin\source\repos\DynamicPy\script.py");
}
catch (Exception ex)
{
Console.WriteLine("Python wurde integriert!" + ex.Message);
}
Console.WriteLine("Ende");
Console.ReadLine();
}
}
}
- Then I created a simple python code for Spacy's Named Entity Recognition:
import spacy
nlp = spacy.load("en_core_web_sm")
text = ("This is an example text.")
doc = nlp(text)
for entity in doc.ents:
print(entity.label_, ": ", entity.text)
** I expected that Spacy's model would be read via C # and relevant entities would be recognized.
**But I get the error 'no module named spacy'
**
I am using:
Visual Studio 2019
Python: 3.7.5
Spacy: v2.3.2
IronPython: 2.7
Metadata
Metadata
Assignees
Labels
No labels