Skip to content

Commit 47e6877

Browse files
Squadrickseanpmorgan
authored andcommitted
Add conditional random fields (#314)
* Port CRF from tf.contrib to tfa.text
1 parent 76e9bb3 commit 47e6877

File tree

5 files changed

+863
-1
lines changed

5 files changed

+863
-1
lines changed

tensorflow_addons/text/BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ py_library(
66
name = "text",
77
srcs = ([
88
"__init__.py",
9+
"crf.py",
910
"skip_gram_ops.py",
1011
]),
1112
data = [
@@ -15,6 +16,19 @@ py_library(
1516
srcs_version = "PY2AND3",
1617
)
1718

19+
py_test(
20+
name = "crf_test",
21+
size = "small",
22+
srcs = [
23+
"crf_test.py",
24+
],
25+
main = "crf_test.py",
26+
srcs_version = "PY2AND3",
27+
deps = [
28+
":text",
29+
],
30+
)
31+
1832
py_test(
1933
name = "skip_gram_ops_test",
2034
size = "small",

tensorflow_addons/text/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
| Submodule | Maintainers | Contact Info |
55
|:---------- |:----------- |:------------- |
66
| skip_gram_ops | | |
7+
| crf | Dheeraj R. Reddy | [email protected] |
78

89
## Components
910
| Submodule | Text Processing Function | Reference |

tensorflow_addons/text/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
from __future__ import division
1818
from __future__ import print_function
1919

20+
# Conditional Random Field
21+
from tensorflow_addons.text.crf import crf_binary_score
22+
from tensorflow_addons.text.crf import crf_decode
23+
from tensorflow_addons.text.crf import crf_decode_backward
24+
from tensorflow_addons.text.crf import crf_decode_forward
25+
from tensorflow_addons.text.crf import crf_forward
26+
from tensorflow_addons.text.crf import crf_log_likelihood
27+
from tensorflow_addons.text.crf import crf_log_norm
28+
from tensorflow_addons.text.crf import crf_multitag_sequence_score
29+
from tensorflow_addons.text.crf import crf_sequence_score
30+
from tensorflow_addons.text.crf import crf_unary_score
31+
from tensorflow_addons.text.crf import viterbi_decode
32+
2033
# Skip Gram Sampling
2134
from tensorflow_addons.text.skip_gram_ops import skip_gram_sample
22-
from tensorflow_addons.text.skip_gram_ops import skip_gram_sample_with_text_vocab
35+
from tensorflow_addons.text.skip_gram_ops import skip_gram_sample_with_text_vocab

0 commit comments

Comments
 (0)