Giter Club home page Giter Club logo

textspan's Introduction

Update February 2024

The textSpan package is deprecated as the function has been rolled into the doc_centrality() function in the R package text2map.

install.packages("text2map")
library(text2map)

help(doc_centrality)

# example
spanning_scores <- doc_centrality(dtm, method = "span")

textSpan

Dustin S. Stoltz and Marshall A. Taylor

textSpan is an R package to measure textual spanning

NOTE: We fixed a coding error with the textSpan function (July 2020)

Overview

Measure details

This is an R package used to measure textual spanning on a document by document similarity matrix. The textSpan function takes this document by document similarity matrix and outputs a document specific measure which increases when a document is similar to documents which are not also similar to each other. This is defined by the following equations:

We define proportional similarities as:

Finally, to make the measure more interpretable, we standardize the output by taking the z-score of each and inverting it such that positive values indicate more textual spanning, while negative values indicate less textual spanning:

See the Step by Step Guide for a detailed breakdown of the steps involved in the function. For more elaborate discussion of the theoretical intuition motivating the measure see Stoltz and Taylor (2019) "Textual Spanning: Finding Discursive Holes in Text Networks" in Socius. The package includes the four simulated similarity matrices used in the paper, but further explanation of the code and data necessary to reproduce the measures, graphs, and plots in the paper can be found here: https://github.com/dustinstoltz/textual_spanning_socius. Note that we issued a correction when we discovered the function was not directly implementing the measure as defined by the equations in the paper. The corrected function, as a result, will precisely replicate the paper revised paper, but not the original.

Performance

To get a sense of how much time and resources textSpan uses up (as written in Base R above), we simulated a handful of similarities matrices between 50x50 and 10000x10000. The machine we used has a dual-core 2.40GHz processor with 16 GB of RAM running Ubuntu, and this chart shows the total minutes and total RAM used on each matrix.

textspan's People

Contributors

dustinstoltz avatar marshall-soc avatar

Stargazers

Sean avatar Will J. avatar mutedial avatar Eryk Walczak avatar Sean Fischer avatar

Watchers

 avatar  avatar

Forkers

marshall-soc

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.