discon

desc <- suppressWarnings(readLines("DESCRIPTION"))
regex <- "(^Version:\\s+)(\\d+\\.\\d+\\.\\d+)"
loc <- grep(regex, desc)
ver <- gsub(regex, "\\2", desc[loc])
verbad <- sprintf('<a href="https://img.shields.io/badge/Version-%s-orange.svg"><img src="https://img.shields.io/badge/Version-%s-orange.svg" alt="Version"/></a></p>', ver, ver)
````
[![Build Status](https://travis-ci.org/trinker/discon.png?branch=master)](https://travis-ci.org/trinker/discon)
[![Coverage Status](https://coveralls.io/repos/trinker/discon/badge.png)](https://coveralls.io/r/trinker/discon)
[![DOI](https://zenodo.org/badge/5398/trinker/discon.svg)](http://dx.doi.org/10.5281/zenodo.15711)
`r verbad`


<img src="inst/discon_logo/r_discon.png" width = "300" alt="discon logo">   


[discon](http://trinker.github.com/discon_dev) is a collection of R tools to enhance analysis of  *discourse connectors* in text.  Discourse connectors are cohesive devices that can be used to help identify themes within a text.  This package provides computational means of extracting and visualizing various elements from the text that contain discourse connectors.  This can assist in qualitative analysis of discourse by identifying categories that may aide analysis (using the computer for efficiency and data coverage) towards generating themes.

> Discourse connectors are devices used to bridge between turns (in speech) and sentences, indicating the logical relations among the parts of a the logical relations among the parts of a framework for the listener/reader.  There are two major classes of discourse connectors: discourse markers and linking adverbials. Discourse markers &ndash; forms like *ok*, *well*, and *now* &ndash; are restricted primarily to spoken discourse. These forms have distinct discourse functions, but it is difficult to identify the specific meaning of the word itself. In contrast, linking adverbials &ndash; forms like *however*, *thus*, *therefore*, *for example* (*e.g.*), and *that is* (*i.e.*) &ndash; are found in both spoken and written registers, and they have greater inherent meaning than discourse markers. (Biber, 2006, p. 66)

Please see the following resources for additional information:

- Alemany, L. A. (2005). [Representing discourse for automatic text summarization via shallow NLP techniques](http://www.cs.famaf.unc.edu.ar/~laura/shallowdisc4summ/tesi_electronica.pdf) (Unpublished doctoral dissertation). Universitat de Barcelona, Barcelona.     
  - [Web Site](http://russell.famaf.unc.edu.ar/~laura/shallowdisc4summ/discmar)    
- Biber, D. (2006). *University language: A corpus-based study of spoken and written registers*. Amsterdam: John Benjamins Publishing Company.
- Halliday, M. A. K. & Hasan, R. (1976). *Cohesion in English*. English Language Series. London: Longman.
- Kalajahi, S. A. R., Abdullah, A. N., Mukundan, J., & Tannacito, D. J. (2012). [Discourse connectors: An overview of the history, definition and classification of the term](http://goo.gl/eS0OwV). *World Applied Sciences Journal, 19*(11), 1659-1673. 
- Linguistic Data Consortium. (2004) [*Simple metadata annotation specification (MDE)*](http://www.itl.nist.gov/iad/mig/tests/rt/2004-fall/docs/SimpleMDE_V6.2-draft.pdf). University of Pennsylvania.  Retrieved from [http://www.itl.nist.gov/iad/mig/tests/rt/2004-fall/docs/SimpleMDE_V6.2-draft.pdf](http://www.itl.nist.gov/iad/mig/tests/rt/2004-fall/docs/SimpleMDE_V6.2-draft.pdf)
- Ryan, G. W. & Bernard, H. R. (2003). [Techniques to identify themes](http://goo.gl/KdYxB8). *Field Methods.  15*(1), 85-109. doi:[10.1177/1525822X02239569.](http://fmx.sagepub.com/content/15/1/85)
- Schiffrin, D. (1987). *Discourse markers*. London: Cambridge University Press.      
- Schiffrin, D. (2001). [Discourse markers: Language, meaning, and context](http://goo.gl/KbwG9I). In D. Schiffrin, D., D. Tannen, & H. E. Hamilton, (Eds.) *The handbook of discourse analysis* (pp. 54-75). Malden, MA: Blackwell Publishing.
- Ward, N. (2000, October). [Issues in the Transcription of English Conversational Grunts](http://www.aclweb.org/anthology/W00-1004). *Proceedings of the 1st SIGdial Workshop on Discourse and Dialogue* (pp. 29&mdash;35). Hong Kong: Association for Computational Linguistics.  Retrieved from [http://www.aclweb.org/anthology/W00-1004](http://www.aclweb.org/anthology/W00-1004)


## Installation

To download the development version of discon:

Download the [zip ball](https://github.com/trinker/discon/zipball/master) or [tar ball](https://github.com/trinker/discon/tarball/master), decompress and run `R CMD INSTALL` on it, or use the **pacman** package to install the development version:

```r
if (!require("pacman")) install.packages("pacman")
pacman::p_load_gh(
    "trinker/qdapRegex", 
    "trinker/qdapTools", 
    "trinker/qdapDictionaries", 
    "trinker/qdap",
    "trinker/discon"
)

Help

Contact

You are welcome to: submit suggestions and bug-reports at: https://github.com/trinker/discon/issues send a pull request on: https://github.com/trinker/discon/ * compose a friendly e-mail to: tyler.rinker@gmail.com

List of Discourse Connector Functions

  1. discourse_connector & discourse_connector_logical
  2. dc_backchannel
  3. dc_causality & dc_causality_sub
  4. dc_comparison
  5. dc_connective & dc_connective_sub
  6. dc_context & dc_context_sub
  7. dc_equality & dc_equality_sub
  8. dc_filled_pause
  9. dc_negator
  10. dc_oh & dc_oh_begin
  11. dc_revision
  12. dc_timing
  13. dc_typology
  14. dc_well & dc_well_begin
  15. kwic (Key Words in Context)

*Note that all discourse_connector based functions (incuding functions prefixed with dc_) have generic plot method that utilizes qdap::dispersion_plot to generate a lexical dispersion plot.

Examples

if (!require("pacman")) install.packages("pacman")
pacman::p_load(discon)
knitr::opts_chunk$set(fig.path = "inst/figure/")

Specific Discourse Connector/Connector Functions

Specific discourse connector functions for exploring the context in which such markers are used. Note these functions are prefixed with a dc_ (for discourse connector).

Causality

causality_1 <- with(pres_debates2012, dc_causality(dialogue, person))
plot(causality_1)
plot(causality_1[[1]], high = "darkgreen")
causality_1[1]
head(causality_1[[2]])

Causality: Subgroups

causality_2 <- with(pres_debates2012, dc_causality_sub(dialogue, person))
plot(causality_2, bg.color = "grey60", color = "blue", 
    total.color = "grey40", horiz.color="grey20")
causality_2[1]
head(causality_2[[2]])
head(causality_2[[3]])

Revision

revision <- with(pres_debates2012[1:20, ], dc_revision(dialogue, person))
revision[1]
revision[2]

Typology

typology <- with(pres_debates2012[1:120, ], dc_typology(dialogue, person))
typology[1]
typology[2]
typology[3]

Generalizable Discourse Connector Function

We will now examine discourse_connector, the basic root function that all of the other dc_ prefixed functions are based upon. This can be used by the researcher to find specific text elements + surrounding context.

## Marker with one type (just: "I")
i_disc <- with(pres_debates2012, discourse_connector(dialogue, person,
    names = c("I"),
    regex = "\\bI('[a-z]+)*\\b",
    terms = list(I = c(" I ", " I'"))
))
i_disc[[1]]
head(i_disc[[2]])
## Marker with two types (both: "I" & "you")
i_you_disc <- with(pres_debates2012, discourse_connector(dialogue, person,
    names = c("I", "you"),
    regex =  list(
        I = "I('[a-z]+)*\\b",
        you = "(\\b[Yy]ou('[a-z]+)*\\b)"
    ),
    terms = list(
        I = c(" I ", " I'"),
        you = c(" you ", " you'")
    )
))
i_you_disc[[1]]
head(i_you_disc[[2]])
head(i_you_disc[[3]])

Key Words in Context

keyWords <- with(pres_debates2012, kwic(dialogue, list(time, person)))
plot(keyWords[[1]], high = "red")
with(pres_debates2012, plot(keyWords, grouping.var = person, rm.vars = time, 
    total.color = NULL, bg.color = "black", color = "yellow", 
    horiz.color="grey20"))
head(keyWords[[2]])


trinker/discon documentation built on May 31, 2019, 8:42 p.m.