MyNixOS website logo
Description

Linguistic Matching and Accommodation.

Measure similarity between texts. Offers a variety of processing tools and similarity metrics to facilitate flexible representation of texts and matching. Implements forms of Language Style Matching (Ireland & Pennebaker, 2010) <doi:10.1037/a0020386> and Latent Semantic Analysis (Landauer & Dumais, 1997) <doi:10.1037/0033-295X.104.2.211>.

lingmatch

An all-in-one R package for the assessment of linguistic matching and/or accommodation.

features

  • Input raw text, a document-term matrix (DTM), or LIWC output.
  • Apply various weighting functions to a DTM.
  • Measure similarity and/or accommodation with various metrics.
  • Calculate standard forms of Language Style Matching (LSM) and Latent Semantic Similarity (LSS).

resources

installation

Download R from r-project.org, then install the package from an R console:

Release (version 1.0.7)

install.packages("lingmatch")

Development (version 1.0.8)

# install.packages("remotes")
remotes::install_github("miserman/lingmatch")

And load the package:

library(lingmatch)

examples

Can make a quick comparison between two bits of text; by default this will give the cosine similarity between raw word-count vectors:

lingmatch("First text to look at.", "Text to compare that text with.")

Or, given a vector of texts:

text = c(
  "Why, hello there! How are you this evening?",
  "I am well, thank you for your inquiry!",
  "You are a most good at social interactions person!",
  "Why, thank you! You're not all bad yourself!"
)

Process the texts in one step:

# with a dictionary
inquirer_cats = lma_process(text, dict = "inquirer", dir = "~/Dictionaries")

# with a latent semantic space
glove_vectors = lma_process(text, space = "glove", dir = "~/Latent Semantic Spaces")

Or process the texts step by step, then measure similarity between each:

dtm = lma_dtm(text)
dtm_weighted = lma_weight(dtm)
dtm_categorized = lma_termcat(dtm_weighted, lma_dict(1:9))
similarity = lma_simets(dtm_categorized, metric = "canberra")

Or do that within a single function call:

similarity = lingmatch(
  text, weight = "frequency", dict = lma_dict(1:9), metric = "canberra"
)$sim

Or, if you want a standard form (as in this example), specify a default:

similarity = lingmatch(text, type = "lsm")$sim
Metadata

Version

1.0.7

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows