Coder Social home page Coder Social logo

digitallinguistics / javascript Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 0.0 862 KB

A JavaScript library for working with linguistic data in DLx format

Home Page: https://developer.digitallinguistics.io/javascript

License: MIT License

JavaScript 100.00%
dlx digital-linguistics linguistics computational-linguistics digital-humanities language-documentation documentary-linguistics

javascript's Introduction

DLx Organization Profile

This repository contains the code for the Digital Linguistics (DLx) profile page.

javascript's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

javascript's Issues

add IPA character list to data

This can be used for validating IPA strings, after the string is normalized using Normalization Form Canonical Decomposition (NFD).

create Language model

Extend from base Model class.

Cannibalize the Language model in the /archive folder, but just make issues for its code, rather than adding it to the PR for this issue.

dateCreated and dateModified should be set automatically

This feature should apply to any models that have these properties. These properties should not be set if they're already present and contain data.

The dateCreated field should be frozen after it's populated (or if it's already populated).

add utilities module to library

You'll need to figure out how to avoid a namespace conflict between user-facing vs. project-internal utilities. Maybe call the user-facing one "tools".

  • add description to readme

add a ".json" attribute to all models

This returns the result of calling .toJSON().

  /**
   * Returns a JSON representation of this model, as a string
   * @return {String} The JSON string
   */
  get json() {
    return JSON.stringify(this.toJSON(), null, 2);
  }

create upload script

  • latest file
  • versioned file
  • unversioned latest file
  • add this script to the publish workflow for GitHub actions

update readme

  • use the readme checklist
  • link to API documentation (#5)
  • overview of main modules in the library
    • models (#45)
    • data (#44)
    • converters (#27)
    • utilities (#46) (maybe tools to avoid a namespace conflict?)
  • aliases
    • MultiLangString : String (#47)
    • Location : Place (#48)

validateIPAString

A utility that checks whether an IPA string contains only valid IPA characters.

add tokenize utility

Make this a dependency, with its own library.

  • tokenize
  • Tokenizer
  • sanitize
  • Sanitizer

create maintainers guide

  • This project does not use a dist branch. All code deployes from the master branch.

  • This project follows a simple branching model, where issue branches are created off the master branch and merged back in when complete.

  • versioning model

  • versioning and release process

add Language.name

This property should be an instance of the MultiLangString model.

Description: The name of this Language, as a [MultiLangString]{@link dlx.module:models.MultiLangString}.

Test

  it(`Language.prototype.name`, function() {
    expect(lang.name instanceof MultiLangString).toBe(true);
    expect(lang.data.name.eng).toBe(`Chitimacha`);
    // also test that this can be a String
  });

add gloss parser utility

This will parse a string of morphemic glosses and return it as an array of words, each of which is an array of glosses.

Copy this code from your dissertation's scripts folder (and then install it in your dissertation so the code isn't duplicated).

validate data when objects are created

Do not use the ajv library for this (which would require it as a dependency). Just use setters and Proxies to validate individual fields as appropriate.

require "type" attribute

Each model should have a type field (where relevant) that is configurable but not writable. This field should be CamelCase, and should fail silently when the user attempts to set it.

set up GitHub actions

  • run tests
  • add readme badge for master branch
  • deploy from master branch to npm on release
  • deploy docs to gh-pages on release

set up project documentation

  • /docs folder is excluded from git
  • JSDoc generates to /docs folder
  • /docs folder is deployed to gh-pages branch
  • add links to documentation in readme

setup Zenodo

  • enable archiving of the repository
  • make a release
  • add citation / DOI to readme

Please consider citing this library, using the following model:

Hieber, Daniel W. 2019. digitallinguistics/javascript. DOI:[][DOI]

add "getUniqueCharacters()" utility

This can be its own micro-library, with its own repo, published to npm, and included in this JS library as a dependency.

/**
 * Returns an array of all the unique characters in a string. Works with both UTF-8 and UTF-16 encoding.
 * @param  {String} string The string to retrieve unique characters from
 * @return {Array}         Returns an array of the unique characters
 * @instance
 */
function getUniqueChars(string) {

  if (typeof string !== `string`) {
    throw new TypeError(`The argument passed to getUniqueChars must be a string.`);
  }

  return Array.from(new Set(string));

}

setup GitHub pages

Serve this from the master branch for the time being, then switch to the /docs folder when it's ready.

add a "data" attribute on all models

This attribute is a getter that returns a POJO.

You might just store the data internally within the class as a private data variable, and return that object when .data is accessed.

  /**
   * Returns a POJO (Plain Old JavaScript Object) representation of this model
   * @return {Object}
   */
  get data() {
    return JSON.parse(this.json);
  }

add .anonymize() method

Add this method to any models containing personal information, to strip that information from the model.

add pull request template

  • inline code commenting in JSDoc style
  • check that API documentation is updated properly according to your comments

Utterance.phonetic should validate IPA characters

Use the validateIPAString method (#52).

The spec can't do this by itself, since this kind of validation can't realistically be performed using regular expressions alone. So AJV can't be used to validate the phonetic transcription against the JSON Schema for it.

Instead, normalize the string using Normalization Form Canonical Decomposition (NFD), and then check that all those characters are included in the list of IPA characters.

support default languages / orthographies

  • defaultAnalysisLanguage
  • defaultOrthography
  • alias them as separate properties (.txn, .tln)

Alternatively, instead of aliasing them as separate properties, you can have fields like defaultName and defaultAutonym.

You could just add a default property to the MultiLangString, Transcription, and Translation objects.

From the app:

function getDisplayName(n) {
  return typeof n === `string` ? n : n.get(`en`) || n.get(`eng`) || Array.from(Object.keys(n))[0];
}

This property should be a getter. It should also refer to a defaultOrthography property etc. if available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.