diff --git a/Cargo.lock b/Cargo.lock
index 6c7fd2a..e7a7121 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,20 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-[[package]]
-name = "addr2line"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
-dependencies = [
- "gimli",
-]
-
-[[package]]
-name = "adler"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
-
[[package]]
name = "adler32"
version = "1.2.0"
@@ -51,20 +36,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
-[[package]]
-name = "backtrace"
-version = "0.3.53"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "707b586e0e2f247cbde68cdd2c3ce69ea7b7be43e1c5b426e37c9319c4b9838e"
-dependencies = [
- "addr2line",
- "cfg-if 1.0.0",
- "libc",
- "miniz_oxide 0.4.3",
- "object",
- "rustc-demangle",
-]
-
[[package]]
name = "byteorder"
version = "1.3.4"
@@ -213,28 +184,6 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
-[[package]]
-name = "failure"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
-dependencies = [
- "backtrace",
- "failure_derive",
-]
-
-[[package]]
-name = "failure_derive"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "synstructure",
-]
-
[[package]]
name = "ffi-support"
version = "0.4.2"
@@ -260,7 +209,7 @@ dependencies = [
"cfg-if 0.1.10",
"crc32fast",
"libc",
- "miniz_oxide 0.3.7",
+ "miniz_oxide",
]
[[package]]
@@ -280,12 +229,6 @@ dependencies = [
"wasi 0.9.0+wasi-snapshot-preview1",
]
-[[package]]
-name = "gimli"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
-
[[package]]
name = "half"
version = "1.6.0"
@@ -410,16 +353,6 @@ dependencies = [
"adler32",
]
-[[package]]
-name = "miniz_oxide"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
-dependencies = [
- "adler",
- "autocfg",
-]
-
[[package]]
name = "multimap"
version = "0.8.2"
@@ -489,12 +422,6 @@ dependencies = [
"serde_derive",
]
-[[package]]
-name = "object"
-version = "0.21.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693"
-
[[package]]
name = "ohnomore"
version = "0.2.2"
@@ -740,12 +667,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "rustc-demangle"
-version = "0.1.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232"
-
[[package]]
name = "ryu"
version = "1.0.5"
@@ -860,22 +781,10 @@ dependencies = [
"unicode-xid",
]
-[[package]]
-name = "synstructure"
-version = "0.12.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "unicode-xid",
-]
-
[[package]]
name = "syntaxdot"
-version = "0.2.0"
-source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#6ccbeaa1586a042c680d70f15d6ab415662b57e4"
+version = "0.3.0-beta.0"
+source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#84dc8211b791e047b925e23566e6aa65de443f57"
dependencies = [
"conllu",
"log",
@@ -897,8 +806,8 @@ dependencies = [
[[package]]
name = "syntaxdot-encoders"
-version = "0.2.0"
-source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#6ccbeaa1586a042c680d70f15d6ab415662b57e4"
+version = "0.3.0-beta.0"
+source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#84dc8211b791e047b925e23566e6aa65de443f57"
dependencies = [
"conllu",
"itertools 0.9.0",
@@ -939,8 +848,8 @@ dependencies = [
[[package]]
name = "syntaxdot-tch-ext"
-version = "0.2.0"
-source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#6ccbeaa1586a042c680d70f15d6ab415662b57e4"
+version = "0.3.0-beta.0"
+source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#84dc8211b791e047b925e23566e6aa65de443f57"
dependencies = [
"itertools 0.9.0",
"tch",
@@ -948,8 +857,8 @@ dependencies = [
[[package]]
name = "syntaxdot-tokenizers"
-version = "0.2.0"
-source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#6ccbeaa1586a042c680d70f15d6ab415662b57e4"
+version = "0.3.0-beta.0"
+source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#84dc8211b791e047b925e23566e6aa65de443f57"
dependencies = [
"conllu",
"ndarray",
@@ -960,8 +869,8 @@ dependencies = [
[[package]]
name = "syntaxdot-transformers"
-version = "0.2.0"
-source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#6ccbeaa1586a042c680d70f15d6ab415662b57e4"
+version = "0.3.0-beta.0"
+source = "git+https://github.com/tensordot/syntaxdot.git?branch=main#84dc8211b791e047b925e23566e6aa65de443f57"
dependencies = [
"serde",
"syntaxdot-tch-ext",
@@ -971,9 +880,8 @@ dependencies = [
[[package]]
name = "tch"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b4b011115a312db130e804d41329e4d13a199d3b7ce66cc3971713afb22382a"
+version = "0.3.1"
+source = "git+https://github.com/LaurentMazare/tch-rs.git#ce9b9dc3193d0e24eb321c08ed8ee970d4013ba9"
dependencies = [
"half",
"lazy_static",
@@ -1056,14 +964,13 @@ dependencies = [
[[package]]
name = "torch-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef4f8aea151542d5321ac378fd718a87521adb8bc026eb5b2697106503f362c"
+version = "0.3.1"
+source = "git+https://github.com/LaurentMazare/tch-rs.git#ce9b9dc3193d0e24eb321c08ed8ee970d4013ba9"
dependencies = [
+ "anyhow",
"cc",
"cmake",
"curl",
- "failure",
"libc",
"zip",
]
diff --git a/Cargo.toml b/Cargo.toml
index 4de7857..1ab0e87 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,4 +29,7 @@ prost-build = "0.6"
pretty_assertions = "0.6"
[features]
-model-tests = []
\ No newline at end of file
+model-tests = []
+
+[patch.crates-io]
+tch = { git = "https://github.com/LaurentMazare/tch-rs.git" }
\ No newline at end of file
diff --git a/include/syntaxdot.h b/include/syntaxdot.h
index a3cb0ea..9a41410 100644
--- a/include/syntaxdot.h
+++ b/include/syntaxdot.h
@@ -90,6 +90,13 @@ void syntaxdot_set_num_intraop_threads(int32_t n_threads);
*/
void syntaxdot_set_num_intraop_threads(int32_t n_threads);
+/**
+ * Get the syntaxdot version.
+ *
+ * The returned string must not be deallocated.
+ */
+char const *syntaxdot_version();
+
/**
* Free a ByteBuffer.
* @param buf The buffer to free.
diff --git a/src/lib.rs b/src/lib.rs
index 47311d0..3a88d47 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,6 +10,8 @@ use annotator::Annotator;
mod error;
use error::AnnotatorError;
+use std::ffi::CString;
+use std::os::raw::c_char;
pub mod sentences;
@@ -17,6 +19,7 @@ mod util;
lazy_static! {
static ref ANNOTATORS: ConcurrentHandleMap = ConcurrentHandleMap::new();
+ static ref SYNTAXDOT_VERSION: CString = CString::new(syntaxdot::VERSION).unwrap();
}
define_bytebuffer_destructor!(syntaxdot_free_bytebuffer);
@@ -81,6 +84,14 @@ pub extern "C" fn syntaxdot_set_num_intraop_threads(n_threads: i32) {
tch::set_num_threads(n_threads);
}
+/// Get the syntaxdot version.
+///
+/// The returned string must not be deallocated.
+#[no_mangle]
+pub extern "C" fn syntaxdot_version() -> *const c_char {
+ SYNTAXDOT_VERSION.as_ptr()
+}
+
#[cfg(test)]
mod tests {
use std::ffi::CString;