0.17.10 • Published 8 years ago

@digitallinguistics/dlx-js v0.17.10

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

DLx JavaScript SDK

Digital Linguistics (DLx) is the science of the digital management of linguistic data, of the kind typically produced by linguists during language documentation projects. This repository contains a JavaScript library for working with linguistic data in the Digital Linguistics data format. It includes Models for various linguistic objects. Works in both browser and Node.

npm (scoped) Build Status GitHub issues DOI

GitHub forks GitHub stars

See the reference documentation for complete details on how to use the library.

Installation

If using yarn:

yarn add @digitallinguistics/dlx-js

If using npm:

npm i --save @digitallinguistics/dlx-js

You can also include the dlx-js script in your page using the DLx CDN.

<script src=https://cdn.digitallinguistics.io/scripts/dlx.js></script>

Or download the script manually:

curl https://digitallinguistics.blob.core.windows.net/scripts/dlx.js -o dlx.js

Including the DLx Library in Your Code

In Node, you can require() the package in your JS files:

const dlx = require('dlx-js');

In the browser, the dlx-js library may be used either as a module (all module types are supported, including ES6), or a regular script. If using the library as a regular script, dlx will be made available as a global variable.

Using ES6 modules:

import * as dlx from './dlx.js';

Using CommonJS modules:

const dlx = require('dlx-js');

As a regular script:

<script src=dlx.js></script>

<script>
  // `dlx` is available as a global variable
  const { Language } = dlx.models;
</script>

Basic Usage

const { Sentence } = dlx.models;
const { Text }     = dlx.models;
const { tokenize } = dlx.utils;

const sentence = new Sentence();
const text     = new Text();
const tokens   = tokenize('Hello world!');

See the reference documentation for complete details on how to use the library.

Notes

  • The MultiLangString object can be accessed either via dlx.models.MultiLangString or dlx.models.String (to avoid conflict with the global String object).
  • The Location object can be accessed either via dlx.models.Location or dlx.models.Place (to avoid conflict with the global Location object in browsers).
  • The Utilities module can be accessed as either dlx.utilities or dlx.utils.
  • All models validate their own data when they are created.
  • The dlx-js library always supports the latest major version of the DLx schemas. It is not guaranteed to support older versions. However, minor versions within the same major release are supported. (For example, if the current version of the DLx format is 5.2.0, the dlx-js library will also support versions 5.1.0 and 5.0.0, but not version 4.x or lower.)

Tests

Tests were created using Jasmine. To run the Node tests, make sure you have Jasmine installed, install dlx-js, then run npm test in your project directory. To run the tests in the browser, download the dlx-js repository, and open the file test/spec/index.html in your browser.

Want to Contribute?

Check out DLx's general contributing guidelines.

Maintainers

This repo is maintained by:

0.17.10

8 years ago

0.17.9

8 years ago

0.17.8

8 years ago

0.17.7

8 years ago

0.17.6

8 years ago

0.17.5

8 years ago

0.17.4

8 years ago

0.17.3

8 years ago

0.17.2

8 years ago

0.17.1

8 years ago

0.17.0

8 years ago

0.16.0

8 years ago

0.15.1

8 years ago

0.15.0

8 years ago

0.14.0

8 years ago

0.13.2

8 years ago

0.12.3

8 years ago

0.12.2

8 years ago

0.12.1

8 years ago

0.12.0

8 years ago

0.11.4

8 years ago

0.11.3

8 years ago

0.11.2

8 years ago

0.11.1

8 years ago

0.11.0

8 years ago

0.10.0

8 years ago

0.9.6

8 years ago

0.9.5

8 years ago

0.9.4

8 years ago

0.9.3

8 years ago

0.9.1

8 years ago

0.8.0

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.5.0

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.1

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago