Python and .NET integration

前端 未结 3 2119
無奈伤痛
無奈伤痛 2021-02-15 18:23

I\'m currently looking at python because I really like the text parsing capabilities and the nltk library, but traditionally I am a .Net/C# programmer. I don\'t think IronPytho

相关标签:
3条回答
  • 2021-02-15 19:01

    Just an Idea

    How about running Python behind as a server, and connect it from .NET with socket?

    Since NLTK loading take time and better load it in advance anyway.

    0 讨论(0)
  • 2021-02-15 19:05

    I don't know why you have a problem with IronPython. you can still use any and all nltk calls there.

    To answer your question about porting a Python class into C#: try compiling your python code into an EXE. This creates a DLL with all your python classes in it. This is something that has been around for a while and it has worked like a charm for me in the past

    0 讨论(0)
  • 2021-02-15 19:24

    NLTK is pure-python and thus can be made to run on IronPython easily. A search turned up this ticket - all one has to do is install a couple of extra Python libraries that don't come by default with IronPython.

    This is probably the easiest way for you to integrate. Otherwise, you'll have to either run Python as a subprocess, which sounds complex, or run Python as a server that answers your requests. This is probably the most scalable, though complex, approach. If you go this way, consider Twisted to simplify the server code.

    But do try IronPython first...

    0 讨论(0)
提交回复
热议问题