Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@foxford/morfana

Package Overview
Dependencies
Maintainers
9
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@foxford/morfana

Morphemes higlighting library

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
increased by100%
Maintainers
9
Weekly downloads
 
Created
Source

Morfana

Library for morphemes higlighting specializing in Russian language. Inspired by kityan/morfana library

Commands

CommandDescription
buildbuild es and generate types
build:esbuild es
build:typesbuild types
coveragecheck test coverage
lintlint code with eslint
startrun docs for developing
storybookrun storybook for developing
build-storybookbuild docs
testrun tests
type-checkcheck typings
type-check:watchstart ts server in watch mode

Syntax

Markdown prefixMorpheme
prprefix
susuffix
popostfix
roroot
enending
ststem

Word description looks like this:

ro:0-5;en:6-8;st:1-5;

Customisation

Config has a variety of options for customisation. Replace letter or morpheme wrapper to ad interactivity.

ParameterTypeDescription
strokeWidthnumberMorpheme view stroke width (px)
strokeColorstringMorpheme view stroke color
markupItemsDelimeterstringMarkup items delimeter
markupKeyValDelimeterstringMarkup key/value delimeter
markupRangeDelimeterstringMarkup range start/end delimeter
zeroEndingSymbolstringZero ending symbol
letterHeightnumberLetter component height (px)
letterWidthnumberLetter component width (px)
morphemeSpacingnumberMorphemes horisontal spacing (px)
morphemeHeightRationumber0-1 Morphemes root node height ratio. Adjusts morhemes paths heihgt
letterComponentFC<LetterProps>Custom Letter component
morphemeWrapperComponentFC<MorphemeWrapperProps>Custom morpheme wrapper component
morphemesViewsMapMorphemesViewsCustom morpheme views component map
morphemesTypesMapMorphemesTypesCustom morpheme types map (used in markup)
errorsLogLevelErrorsLogLevelErrors log level
loggerLoggerLogger with 3 methods: info, warn, error

Methods

Morfana's class methods

MethodDescription
setConfigSet instance config
getConfigGet instance config
logLog error or other message (according to current log level)
validateMarkupCheck validity of markup elements string e.g. "ro:1-5", return valid values
parseMarkupParse markup string e.g. "ro:1-5;en:6-8;st:1-5;" into array "ro:1-5", "en:6-8", "st:1-5"
getMarkupDataPrepare markup data, e.g. from array of 'ro:1-5' to array of { type: 'ro', range: [1, 5] }
prepareWordPrepare word for parsing (add zero ending symbol)
getSymbolsMapGet symbols map with morhpemes data
processProcess markup and word to get symbols map and markup data for the markup display
getMarkupFromMarkupDataGet markup string from markupData

Components

MarkedWord

Component renders word and morphemes based on the markup string. Uses Word as a view component.

Word

Component that renders word and morphemes based on symbols map and markup data.

Letter

Component that renders symbol in a box of certain configured dimentions. Can be replaced in config in order to add styles or functionality.

Morpheme

Component that renders morpheme. Can be replaced in config in order to add styles or functionality.

MorphemeWrapper

Component that wraps morpheme.

Recomendations

It is recomended to use monospace font in order to avoid akward letter spacing.

FAQs

Package last updated on 28 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc