https://github.com/chchch/upama

A PHP library for comparing two or more Sanskrit TEI XML files and generating an apparatus with variants

https://github.com/chchch/upama

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.7%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

A PHP library for comparing two or more Sanskrit TEI XML files and generating an apparatus with variants

Basic Info
  • Host: GitHub
  • Owner: chchch
  • License: gpl-2.0
  • Language: PHP
  • Default Branch: master
  • Homepage:
  • Size: 14 MB
Statistics
  • Stars: 12
  • Watchers: 7
  • Forks: 1
  • Open Issues: 68
  • Releases: 1
Created about 11 years ago · Last pushed 10 months ago
Metadata Files
Readme License

README.md

upama

A PHP library for comparing two or more Sanskrit TEI XML files and generating an apparatus with variants

This library depends on the php port of Google's diff-match-patch library by yetanotherape: https://github.com/yetanotherape/diff-match-patch

Here is an example of how to compare two files:

``` <?php include "upama.php";

$upama = new Upama(); $comparison = $upama->compare('file1.xml','file2.xml'); $stylesheet = 'apparatus.xsl';

echo $upama->transform($comparison,$stylesheet);

?> ```

This will render the file named "file1.xml" with an apparatus containing variants from "file2.xml", using the XSLT stylesheet called "apparatus.xsl" and outputting in HTML. Both XML files should have text structure elements with xml:id attributes; these will be matched by the collation engine. In addition, at least "file2.xml" should have a siglum defined in the <teiHeader>. A typical, minimal file should look like this:

```

Title of the text Author of the text Siglum used for this witness in the apparatus

      <msContents>
         <msItem>
            <textLang mainlang="sa-Deva">Sanskrit.</textLang>
         </msItem>
      </msContents>
   </msDesc>
  </sourceDesc>
</fileDesc>

Some paragraph elements

a verse another verse

```

The text should be transcribed in IAST in order for Upama to work properly. The mainLang attribute of the textLang tag should be sa-Latn, sa-Deva, sa-Mlym, sa-Telu, etc. depending on what script the original document is written in. Some of the text normalization functions rely on this attribute being set.

In order to compare a text with more than two witnesses, use the "collate" function:

``` <?php include "upama.php";

$upama = new Upama(); $comparison1 = $upama->compare('file1.xml','file2.xml'); $comparison2 = $upama->compare('file1.xml','file3.xml');

$collation = $upama->collate($comparison1,$comparison2); $stylesheet = 'apparatus.xsl';

echo $upama->transform($collation,$stylesheet);

?> ```

the DokuWiki plugin

A live demo of upama.php in action can be found at https://saktumiva.org/wiki/dravyasamuddesa/start.

The code for the plugin and template used on saktumiva.org, which runs on DokuWiki, is in the dokuwiki directory. The plugin includes the hyphenation engine hypher (https://github.com/bramstein/hypher) with a Sanskrit hyphenation library (both IAST and indic scripts supported) as well as some functions based on sanscript.js (https://github.com/sanskrit/sanscript) to convert between scripts.

To get it running on your own webserver, 1. install a copy of DokuWiki 2. copy the template directory (saktumiva/) into the lib/tpl/ directory 3. copy the plugin directory (upama/) into the lib/plugins/ directory 4. make sure that you have a sidebar page in data/pages/, even if it is blank

Owner

  • Login: chchch
  • Kind: user

GitHub Events

Total
  • Issues event: 17
  • Watch event: 2
  • Issue comment event: 12
  • Push event: 1
Last Year
  • Issues event: 17
  • Watch event: 2
  • Issue comment event: 12
  • Push event: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 21
  • Total pull requests: 1
  • Average time to close issues: 2 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 0.38
  • Average comments per pull request: 5.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 12
  • Pull requests: 0
  • Average time to close issues: 4 months
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.33
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • wujastyk (20)
  • chakrabortydeepro (1)
Pull Request Authors
  • wujastyk (1)
Top Labels
Issue Labels
Pull Request Labels