Conllu 1.1.2
dotnet add package Conllu --version 1.1.2
NuGet\Install-Package Conllu -Version 1.1.2
<PackageReference Include="Conllu" Version="1.1.2" />
paket add Conllu --version 1.1.2
#r "nuget: Conllu, 1.1.2"
// Install Conllu as a Cake Addin #addin nuget:?package=Conllu&version=1.1.2 // Install Conllu as a Cake Tool #tool nuget:?package=Conllu&version=1.1.2
CoNLL-U Parser in .NET Core
This repository contains a lightweight, well-tested CoNLL-U parser written in C# .NET Core and parses according to the CoNLL-U format as specified by Universal Dependencies.
Quick Start
CoNLL-U is available as a NuGet package. Once installed, you can start as follows:
var filePath = ...
var sentences = ConlluParser.ParseFile(filePath);
Each Sentence
contains a list of Token
which contain all the information as specified in the CoNLL-U format. Below is a short overview of some of the fields that are available in the Token
class:
public class Token
{
// CoNLL-U Properties
int Id;
string Form;
string Lemma;
string Upos;
string Xpos;
Dictionary<string, string> Feats;
int? Head;
string DepRel;
Dictionary<TokenIdentifier, string> Deps;
string Misc;
// Other properties
TokenIdentifier Identifier;
string RawLine;
bool IsMultiwordToken;
bool IsEmptyNode;
}
In addition, there is a TokenIdentifier
class which wraps the different possibilities for word ID such as multi word tokens or empty nodes.
You can also serialize a Sentence
back into a CoNLL-U file format. You can simply do this as follows:
Sentence s;
var text = ConlluParser.Serialize(s);
System.IO.File.WriteAllText(@"C:\path\to\file.conllu", text);
To-do
Below is a list of items that are still planned for the package. Feel free to open an issue or pull request for any other additional functionalities and/or bugfixes.
- Support empty nodes
- Add serialization support to generate .conllu files
- Add tree parsing helper functions
License
Copyright (c) 2021 Arthur Hemmer
Distributed under the MIT License (MIT).
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Conllu:
Package | Downloads |
---|---|
Chiron.Nlp
Chiron NLP-related components |
|
Fusi.UDPipe
Minimalist API surface for https://github.com/ufal/udpipe. |
GitHub repositories
This package is not used by any popular GitHub repositories.