JSPM

transformer.ts

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q29806F
  • License BSD-2-Clause

Typescript wrapper for @xenova/transformers

Package Exports

  • transformer.ts
  • transformer.ts/dist/browser.js
  • transformer.ts/dist/cjs.js
  • transformer.ts/dist/esm.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (transformer.ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

transformer.ts

Typescript wrapper for @xenova/transformers

npm Package Version

Supported Tasks

For all task, the model name can be optionally specified in the input object.

More tasks and models will be typed over time.

text-classification (alias: sentiment-analysis)

Input Type: { text: string }

Output Type: Array<{ label: TextClassificationLabel, score: number }>

type TextClassificationLabel =
  // Xenova/distilbert-base-uncased-finetuned-sst-2-english
  | 'POSITIVE'
  | 'NEGATIVE'
  // Xenova/bert-base-multilingual-uncased-sentiment
  | '5 stars'
  | '4 stars'
  | '3 stars'
  | '2 stars'
  | '1 star'
  // Xenova/toxic-bert
  | 'toxic'
  | 'insult'
  | 'obscene'
  | 'identity_hate'
  | 'threat'
  | 'severe_toxic'

zero-shot-classification

Input Type: { text: string, labels: string[] }

Output Type: Array<{ label: string, score: number }>

License

This project is licensed with BSD-2-Clause

This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:

  • The freedom to run the program as you wish, for any purpose
  • The freedom to study how the program works, and change it so it does your computing as you wish
  • The freedom to redistribute copies so you can help others
  • The freedom to distribute copies of your modified versions to others