Giter VIP home page Giter VIP logo

agricolamz / lingglosses Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 2.0 21.25 MB

R package that helps to render interlinear glossed linguistic examples in html rmarkdown documents and then semi-automatically compiles the glosses list

Home Page: https://agricolamz.github.io/lingglosses/

License: GNU General Public License v3.0

R 94.64% TeX 5.36%
r rmarkdown linguistics glosses glosses-list typology language-documentation interlinear-gloss

lingglosses's Introduction

lingglosses: Linguistic glosses and semi-automatic list of glosses creation

CRAN version Project Status: Active – The project has reached a stable, usable state and is being actively developed. DOI R build status

The main goal of the lingglosses R package is to create:

  • linguistic glosses for .html output of rmarkdown;
gloss_example(transliteration = "bur-e-ri c'in-ne-sːu",
              glosses = "fly-NPST-INF know-HAB-NEG", 
              free_translation = "I cannot fly.", 
              comment = "(lit. do not know how to)")
  • semi-automatic compiled abbreviation list.
make_gloss_list()

hab — habitual; inf — infinitive; neg — negation; npst — non-past

For more details see the html-version of the tutorial.

You can also be interested in

Installation

You can install the stable version from CRAN:

install.packages("lingglosses")

You can also install the development version of lingglosses from GitHub with:

# install.packages("remotes")
remotes::install_github("agricolamz/lingglosses")

How to cite this package

citation("lingglosses")
> 
> To cite lingglosses in publications use:
> 
>   Moroz, G. (2021) lingglosses: Linguistic glosses and semi-automatic
>   list of glosses creation. (Version 0.0.2). Zenodo
>   https://doi.org/10.5281/zenodo.5801712
> 
> A BibTeX entry for LaTeX users is
> 
>   @Manual{,
>     title = {lingglosses: Linguistic glosses and semi-automatic list of glosses creation},
>     author = {George Moroz},
>     year = {2021},
>     doi = {10.5281/zenodo.5801712},
>   }

lingglosses's People

Contributors

agricolamz avatar sverhees avatar yihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lingglosses's Issues

Problems with punctuation bing first in the glossing word

This does not work:

gloss_example("jacːaː-**ʁoj** **q’ac’o** j-ec-al",
              "(girl)friend.PL.OBL-**CUM(ESS)** **together** F-stay-INF",
              "Be with the girls.")

result: girl(friend)

But this work:

gloss_example("jacːaː-**ʁoj** **q’ac’o** j-ec-al",
              "{(girl)friend}.PL.OBL-**CUM(ESS)** **together** F-stay-INF",
              "Be with the girls.")

Have you checked very long examples?

This doesn't work. But works with line_length = 90.

gloss_example("et’e et.nayel-u lin-em č’-em kar-oł as-el t’e Hayastan-n aysōr ur klin-er **ar°anc’** Sp’yur°k’-i",
              "CONJ look.back-PTCP.FUT be-SUBJ.FUT.1.SG NEG-be.PRS.1SG can-PRS.PTCP say-INF CONJ Armenia.NOM-the today where be-PST.COND.3.SG **PREP** Diaspora-DAT",
              "If I am about to look back, I cannot say where Armenia would be without the Diaspora.")

implement infix

Something like this should work:

gloss_example("li<b>il", "all<HPL>", "all").

Also check with some Semitic examples.

Square brackets remove a word

library(lingglosses)
gloss_example("soru hek’ʷa=lo **ti-gu**",
              "[together man]=ADD CAR-ADVZ",
              "without a single fellow man")

doesn't work when multiple non-word symbols

gloss_example("xːunul-li tiladi b-arq'-ib ca-b hel-i-cːe \"ma-ax-utːa!\" **r-ik'-ul**",
              "woman-ERG request N-do.PFV-PRET be-N that-OBL-IN PROH-go-PROH.SG F-say.IPFV-ICVB",
              "His wife begged him: do not go!")

the problem with !

linguistic examples without glosses

It would be nice to be able to use the gloss_example function for examples with only one line (e.g. a linguistic example in English which does not require glosses nor translation), so that all examples in one document can be formatted using the same function, which renders them all cursive and adds the same size indent everywhere.

Currently this works for examples with two lines (e.g. an example with just transliteration and glosses, or just transliteration and translation), but if you only add content to the transliteration argument, the package returns an error:

Warning message:
In matrix(for_matrix, nrow = nrow_matrix, byrow = TRUE) :
data length [3] is not a sub-multiple or multiple of the number of rows [2]

Problem with `<>` and `()` in glossing

In that cases:

gloss_example(transliteration = "ʕanči-la-**gi‹b›a** ɬabɬabili-b-aχ m-uʔ-a šːakiba",
              glosses = "stone-SUP-**EL‹N›** fly-N-CVB N-go-AOR	bird",
              free_translation = "The bird flew off the rock.")

image

and

gloss_example(transliteration = "jaxi-ɬːi-č'u-**b-a** b-uq-e din-di ha-b beqi",
              glosses = "girl-OBL-CONT-**N-EL**	N-take_away-AOR	I-ERG	this-N (N)apricot",
              free_translation = "I took this apricot from the girl.")

image

The parser doesn't extract gloss from the <> and () and do not put it into the gloss list.

extended Latin symbols don't render

What I type:

gloss_example(transliteration = "boʔ-ac’a-da",
              glosses = "four-ten-NUM",
              free_translation = "40"
)

What is rendered:

  • bo<U+0294>-ac’a-da
    four-ten-num
    ‘40’

Quite sad :(

More examples:
gloss_example(transliteration = "xːɵ-c’al-wa",
              glosses = "five-ten-NUM.III",
              free_translation = "50"
)

is rendered as:

  • x<U+02D0><U+0275>-c’al-wa
    five-ten-num.iii
    ‘50’

gloss_example(transliteration = "ša-uz-t’q’a-it’ː",   # IPA triangular colon instead of a regular one
              glosses = "two-MULT-twenty-ten",
              free_translation = "50"
)

is rendered as:

  • sa-uz-t’q’a-it’<U+02D0>
    two-mult-twenty-ten
    ‘50’

info about OS and package versions
> sessionInfo()$R.version$platform
[1] "x86_64-w64-mingw32"
> sessionInfo()$R.version$version.string
[1] "R version 4.1.1 (2021-08-10)"
> packageVersion("rmarkdown")
[1] ‘2.17’
> packageVersion("lingglosses")
[1] ‘0.0.4’

`knitr::opts_current` is supposed to be read-only

Hi, I'm not sure what this line is for:

knitr::opts_current$set(results='asis')

I think knitr::asis_output() should suffice:

knitr::asis_output(res)

In the next version of knitr, opts_chunk$set() will throw an error: yihui/knitr#1798 I wonder if you could delete that line if it's not necessary. Thank you very much!

BTW, it will also be nice if you run R CMD check on your package against the dev version of knitr in case I missed any other problems (I only discovered this one on my side).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.