npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

alignment-editor-rcl

v0.2.41

Published

React Component Library for aligning a source text to a target text.

Downloads

2

Readme

Alignment Editor RCL

A react component library providing a user experience for creating, viewing, and modifying an alignment of texts. Try it out here.

Features

  • Ability to view both source and target text as RTL or LTR.
  • updatedState hook for consuming applications to capture changes.
  • Users can align to a source text or an aligned reference (aka "bridge") text.
  • Two alternative view styles.
  • Optional gloss tagging for source text.
  • Experimental part of speech highlighting.

Usage

Add the package:

yarn add alignment-editor-rcl

Import the react component and its provider:

import { AlignmentEditor, AlignmentProvider } from 'alignment-editor-rcl';

Wrapped in its provider, render AlignmentEditor as you would any other react component, providing sourceSegments, targetSegments, (preexisting)links, and a stateUpdatedHook. Optionally, sourceGlosses can be provided:

<AlignmentProvider>
  <AlignmentEditor
    sourceGlosses={[
      { position: 2, glossText: 'anyone' },
      { position: 5, glossText: 'hearer' },
    ]}
    sourceSegments={[
      { text: 'ὅτι' },
      { text: 'εἴ' },
      { text: 'τις' },
      { text: 'ἀκροατὴς' },
      { text: 'λόγου' },
      { text: 'ἐστὶν' },
    ]}
    targetSegments={[
      { text: 'For' },
      { text: 'if' },
      { text: 'anyone' },
      { text: 'is' },
      { text: 'a' },
      { text: 'hearer' },
    ]}
    links={[
      { sources: [0], targets: [1, 2], type: 'manual' },
      { sources: [3], targets: [5], type: 'manual' },
    ]}
    stateUpdatedHook={(a) => {
      console.log('STATE UPDATED', a);
    }}
  />
</AlignmentProvider>

API

Required Parameters

sourceSegments

Represents the source text -- an "original" text that a target will be aligned to.

An array of objects that implement:

interface UserTextSegment {
  text: string;
  partOfSpeech?: string;
}

targetSegments

Represents the target text -- an "translation" text that will be aligned to its source.

An array of objects that implement:

interface UserTextSegment {
  text: string;
  partOfSpeech?: string;
}

Optional Parameters

links

A "link" is an alignment of target text tokens to source text tokens. Links can be Many:Many.

This parameter represents preexisting links. These will be displayed and users can remove or modify them. Note than links can be labeled as 'machine' or 'manual'. In the future, a visual delineation between the two will be provided.

An array of objects that implement: { sources: number[], target: number[], type: 'manual'|'machine' }

referenceSegments

Represents the reference text -- a previously aligned translation of the source that users will align their target to. Reference text mode is enabled by providing referenceSegments and referenceLinks. In reference text mode users can only align to the reference text.

An array of objects that implement:

interface UserTextSegment {
  text: string;
  partOfSpeech?: string;
}

referenceLinks

A set of links that describes the alignment of the reference text to the source. Reference text mode is enabled by providing referenceSegments and referenceLinks.

An array of objects that implement: { sources: number[], target: number[], type: 'manual'|'machine' }

stateUpdatedHook

This hook is a function that will be called by the component library when the user manipulates the state of the links representing the alignment.

The function receives an array of links as specified above.

sourceGlosses

To assist users in alignment activities who may not have extensive knowledge of original languages, a set of sourceGlosses can be provided to the component. When sourceGlosses are turned on, they are displayed as tags providing an additional string of information for source text segments.

An array of objects that implement: { position: number, glossText: string }