pashto-inflector/README.md

97 lines
3.3 KiB
Markdown
Raw Normal View History

2021-03-09 12:39:13 +00:00
# pashto-inflector
2022-11-08 06:07:40 +00:00
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
2021-03-09 12:39:13 +00:00
[![Netlify Status](https://api.netlify.com/api/v1/badges/ca3a7720-876f-4375-a77e-2e7bfdcee48a/deploy-status)](https://app.netlify.com/sites/pashto-verbs/deploys)
2021-04-30 16:30:50 +00:00
![build](https://github.com/lingdocs/pashto-inflector/actions/workflows/ci.yml/badge.svg)
![build](https://github.com/lingdocs/pashto-inflector/actions/workflows/publish.yml/badge.svg)
2021-03-09 12:39:13 +00:00
2023-02-22 18:02:16 +00:00
A pashto inflection, verb conjugation, and phrase-generation engine, as well as functions and components for modifying and displaying Pashto text.
2021-03-09 12:39:13 +00:00
2022-11-08 06:09:21 +00:00
#### [Pashto Inflector Website/Demo](https://pashto-inflector.lingdocs.com)
2021-03-09 12:39:13 +00:00
2023-08-21 10:31:43 +00:00
<p align="center">
<img src="./diagrams/diagram-light.png" />
</p>
2023-08-21 10:29:21 +00:00
2023-06-15 16:10:41 +00:00
## How it works
This library uses a 3-step process to generate gramattically correct Pashto phrases. This 3-step process corresponds directly to Chomsky's tripartrite structure for tranformational generative grammars.
| | Pashto Inflector Function | Chomskian Grammar Level |
|-|--------------------------| ----------------------- |
|1.| Assemble the phrase tree | Phrase Structure Rules |
2024-08-12 19:48:31 +00:00
|2.| Inflect the words in tree | Morphophonemic Rules |
2023-06-15 16:10:41 +00:00
|3.| Arrange the inflected words in order | Transformational Rules |
### 1. Assemble the phrase tree
**Phrase Structure Rules**
An abstract syntax tree is created with the various parts of a phrase represented as dictionary entries of the words as well as information about gender, number, and tense, etc. These are arranged in typed structures that allow for arranging NP and APs into verbal or equative phrases.
### 2. Inflect all the words in the phrase tree
**Morphophonemic Rules**
The dictionary entries for the words are inflected and conjugated as necessary.
### 3. Arrange the inflected words
**Transformational Rules**
The inflected words are arranged into possible phrases with various options for dropping or encliticizing pronouns, and placing the negation particle in the correct place(s).
2023-08-21 10:29:21 +00:00
![Phrase building process](./diagrams/full-phrase-process.svg)
2023-06-15 16:10:41 +00:00
* The full process of phrase building
## Distributions
This is published on [a private NPM proxy registry](https://npm.lingdocs.com) as two libraries:
2022-10-09 10:03:13 +00:00
2022-10-24 08:19:01 +00:00
- @lingdocs/inflect
2023-06-15 16:10:41 +00:00
- `/src/lib`
2022-10-09 10:03:13 +00:00
- The core inflection engine with grammatical information and tools for processing LingDocs dictionary entries and Pashto text.
2022-10-09 10:07:21 +00:00
- Can be used with Node 16, as CommonJS
2022-10-09 10:03:13 +00:00
- @lingdocs/ps-react
2023-06-15 16:10:41 +00:00
- `/src/components`
2022-10-09 10:03:13 +00:00
- @lingdocs/inflect plus react components for displaying Pashto text, phrase engine UI etc.
2022-10-09 10:07:21 +00:00
- Only available as an ES6 Module
2023-01-26 13:00:11 +00:00
`@lingdocs/pashto-inflector` **is deprecated**. Use `@lingdocs/inflect` or `@lingdocs/ps-react` instead.
2022-10-09 10:03:13 +00:00
2021-03-09 12:39:13 +00:00
## Development
The Pashto Verb Explorer website can be used to view and play with the verb conjugations and various components.
```
2023-07-30 11:54:27 +00:00
cd src/components
yarn install
cd ../lib
yarn install
cd ../..
yarn install
2021-03-09 12:39:13 +00:00
yarn start
```
## Building
2021-03-10 17:50:45 +00:00
⚠ Don't use `yarn build`. Use one of the commands below: ⚠
2021-03-09 12:39:13 +00:00
### Website
2021-03-09 13:20:55 +00:00
To build the [Pashto Verb Explorer](https://verbs.lingdocs.com) website:
2021-03-09 12:39:13 +00:00
```
yarn build-website
```
This outputs a site at `/build`
2022-10-09 10:03:13 +00:00
### Libraries
2021-03-09 12:39:13 +00:00
2022-10-09 10:03:13 +00:00
To build the `@lingdocs/inflet` and `@lingdocs/ps-react` libraries ready for publishing to NPM:
2021-03-09 12:39:13 +00:00
```
yarn build-library
```