@ccmaymay/concrete 4.15.0 → 4.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ActiveLearnerClientService.js +249 -249
- package/ActiveLearnerServerService.js +642 -642
- package/AnnotateCommunicationService.js +696 -696
- package/AnnotateWithContextService.js +298 -298
- package/FeedbackService.js +750 -750
- package/FetchCommunicationService.js +709 -709
- package/README.md +125 -0
- package/ResultsServerService.js +2138 -2138
- package/SearchProxyService.js +962 -962
- package/SearchService.js +685 -685
- package/Service.js +373 -373
- package/StoreCommunicationService.js +255 -255
- package/SummarizationService.js +479 -479
- package/access_types.js +168 -168
- package/annotate_types.js +26 -26
- package/audio_types.js +110 -110
- package/cluster_types.js +398 -398
- package/communication_fu.js +432 -432
- package/communication_types.js +845 -845
- package/concrete.js +64 -64
- package/context_types.js +65 -65
- package/email_types.js +477 -477
- package/entities_types.js +658 -658
- package/ex_types.js +82 -82
- package/language_types.js +123 -123
- package/learn_types.js +207 -207
- package/linking_types.js +286 -286
- package/metadata_types.js +926 -926
- package/nitf_types.js +1005 -1005
- package/package.json +26 -5
- package/results_types.js +18 -18
- package/search_types.js +661 -661
- package/services_types.js +384 -384
- package/situations_types.js +1268 -1268
- package/spans_types.js +151 -151
- package/structure_types.js +2311 -2311
- package/summarization_types.js +433 -433
- package/tokenization_fu.js +33 -33
- package/tokentagging_fu.js +241 -241
- package/twitter_types.js +1553 -1553
- package/util.js +117 -117
- package/uuid_types.js +67 -67
package/README.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
concrete-js for Node.js
|
2
|
+
=======================
|
3
|
+
|
4
|
+
*This README describes the Node.js version of **concrete-js**.
|
5
|
+
For the standard jQuery version, see `README-js.md`.*
|
6
|
+
|
7
|
+
**concrete-js** is a Node.js library for working with
|
8
|
+
[Concrete](https://github.com/hltcoe/concrete), a set of NLP data
|
9
|
+
types defined by a [Thrift](https://thrift.apache.org) schema. Thrift
|
10
|
+
makes it easy to use a shared set of data structures across multiple
|
11
|
+
programming languages.
|
12
|
+
|
13
|
+
**concrete-js** is designed for visualization and annotation.
|
14
|
+
While it is *technically* possible to implement NLP algorithms in
|
15
|
+
JavaScript, you should instead use
|
16
|
+
[concrete-python](https://github.com/hltcoe/concrete-python) or
|
17
|
+
[concrete-java](https://github.com/hltcoe/concrete-java).
|
18
|
+
|
19
|
+
In general, you should use **concrete-js** when you have a Concrete
|
20
|
+
*Communication* object that was created by another tool, and need a UI
|
21
|
+
that visually represents data in the *Communication*. You may also
|
22
|
+
need the user/annotator to interactively modify Concrete data
|
23
|
+
structures, and then save their modifications.
|
24
|
+
|
25
|
+
The **concrete-js** library contains:
|
26
|
+
|
27
|
+
- Serialization and deserialization code for Concrete data structures.
|
28
|
+
The serialization code is generated by the Thrift compiler from the
|
29
|
+
[Thrift schema for Concrete](http://hltcoe.github.io/concrete/schema/).
|
30
|
+
- Utility code for working with Concrete objects
|
31
|
+
|
32
|
+
API documentation for **concrete-js** is available at:
|
33
|
+
http://hltcoe.github.io/concrete-js/
|
34
|
+
|
35
|
+
|
36
|
+
Including concrete-js in your project
|
37
|
+
-------------------------------------
|
38
|
+
|
39
|
+
```
|
40
|
+
npm install @ccmaymay/concrete
|
41
|
+
```
|
42
|
+
|
43
|
+
```javascript
|
44
|
+
import thrift from "thrift";
|
45
|
+
import concrete from "concrete";
|
46
|
+
```
|
47
|
+
|
48
|
+
|
49
|
+
Fetching Communications with JavaScript
|
50
|
+
---------------------------------------
|
51
|
+
|
52
|
+
Replace `/FETCH/URL/PATH/`, `FETCH_HOST_ADDRESS`, `9090`, and
|
53
|
+
`["FETCH-COMM-ID-1", "FETCH-COMM-ID-2"]` with the appropriate values
|
54
|
+
for your application:
|
55
|
+
|
56
|
+
```javascript
|
57
|
+
import thrift from "thrift";
|
58
|
+
import concrete from "concrete";
|
59
|
+
|
60
|
+
var options = {
|
61
|
+
transport: thrift.TBufferedTransport,
|
62
|
+
protocol: thrift.TJSONProtocol,
|
63
|
+
path: "/FETCH/URL/PATH/",
|
64
|
+
https: false,
|
65
|
+
};
|
66
|
+
|
67
|
+
const connection = thrift.createXHRConnection(
|
68
|
+
"FETCH-HOST-ADDRESS",
|
69
|
+
9090,
|
70
|
+
options
|
71
|
+
);
|
72
|
+
connection.on("error", function (err) {
|
73
|
+
console.error(err);
|
74
|
+
});
|
75
|
+
|
76
|
+
const client = thrift.createXHRClient(
|
77
|
+
concrete.access.FetchCommunicationService,
|
78
|
+
connection
|
79
|
+
);
|
80
|
+
|
81
|
+
const request = new concrete.access.FetchRequest({
|
82
|
+
communicationIds: ["FETCH-COMM-ID-1", "FETCH-COMM-ID-2"],
|
83
|
+
});
|
84
|
+
client.fetch(request).then((result) =>
|
85
|
+
console.log(result.communications)
|
86
|
+
).catch((error) =>
|
87
|
+
console.error("fetch error: " + error.message);
|
88
|
+
);
|
89
|
+
```
|
90
|
+
|
91
|
+
Building concrete-js
|
92
|
+
--------------------
|
93
|
+
|
94
|
+
You do not need to build **concrete-js** in order to use
|
95
|
+
**concrete-js** - a working copy of the library is included in the
|
96
|
+
`dist/` directory. The **concrete-js** library only needs to
|
97
|
+
(re)built when the Thrift schema files for Concrete have been updated,
|
98
|
+
or when the code in `src/` is modified.
|
99
|
+
|
100
|
+
Requirements for building **concrete-js**:
|
101
|
+
|
102
|
+
* A copy of the [Concrete](https://github.com/hltcoe/concrete)
|
103
|
+
repo in your home directory - ```${HOME}/concrete```
|
104
|
+
* [Thrift](https://thrift.apache.org)
|
105
|
+
* [Node](http://nodejs.org)
|
106
|
+
* [Grunt](http://gruntjs.com) - a JavaScript build tool
|
107
|
+
|
108
|
+
Install the Node packages required for building **concrete-js** using:
|
109
|
+
|
110
|
+
```
|
111
|
+
npm install
|
112
|
+
```
|
113
|
+
|
114
|
+
Build **concrete-js** using the command:
|
115
|
+
|
116
|
+
```
|
117
|
+
grunt
|
118
|
+
```
|
119
|
+
|
120
|
+
(or perhaps `npx grunt`) which will:
|
121
|
+
|
122
|
+
* call the Thrift compiler to generate JavaScript code for the Thrift schema under ```${HOME}/concrete```
|
123
|
+
* combine the Thrift-generated JavaScript code with the hand-written utility function JavaScript code in a single directory
|
124
|
+
* run [JSHint](http://www.jshint.com) on the combined JavaScript code to check for problems
|
125
|
+
* minify the combined code
|