Text Processing

Learn how deep learning APIs of ML.NET can do text processing.

ML.NET is capable of using deep learning for advanced text analysis, such as accurate sentiment analysis and assessing sentence similarities. For these purposes, ML.NET uses a popular open-source ML library known as PyTorch. In ML.NET, this library is accessed via some NuGet packages.

The following playground demonstrates how two types of text analysis tasks can be done in the context of deep learning in ML.NET with the help of PyTorch:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <PlatformTarget>x64</PlatformTarget>
    <Nullable>disable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="ImageClassificationDemo.training.cs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.ML" Version="3.0.0-preview.23266.6" />
    <PackageReference Include="Microsoft.ML.TorchSharp" Version="0.21.0-preview.23266.6" />
    <PackageReference Include="TorchSharp-cuda-linux" Version="0.99.5" />
  </ItemGroup>

</Project>
Advanced text analysis demo

Note: PyTorch dependencies might take a couple of minutes to build if we lauch the playground.

PyTorch dependencies

First, we'll need to install the ...