An open API service indexing awesome lists of open source software.

https://github.com/trinker/discon

Tools for analyzing discourse connectors in text
https://github.com/trinker/discon

Last synced: 5 months ago
JSON representation

Tools for analyzing discourse connectors in text

Awesome Lists containing this project

README

          

# discon

```{r, echo=FALSE}
desc <- suppressWarnings(readLines("DESCRIPTION"))
regex <- "(^Version:\\s+)(\\d+\\.\\d+\\.\\d+)"
loc <- grep(regex, desc)
ver <- gsub(regex, "\\2", desc[loc])
verbad <- sprintf('Version', 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`

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 – forms like *ok*, *well*, and *now* – 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 – forms like *however*, *thus*, *therefore*, *for example* (*e.g.*), and *that is* (*i.e.*) – 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—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

- [Web Page](http://trinker.github.com/discon/)
- [Package PDF Help Manual](https://dl.dropboxusercontent.com/u/61803503/discon.pdf)

## Contact

You are welcome to:
* submit suggestions and bug-reports at:
* send a pull request on:
* compose a friendly e-mail to:

## 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`
7. `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

```{r, echo=FALSE, message=FALSE}
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

```{r, comment=NA, fig.height=7, fig.width=11}
causality_1 <- with(pres_debates2012, dc_causality(dialogue, person))
plot(causality_1)
```

```{r, comment=NA, fig.height=3, fig.width=4}
plot(causality_1[[1]], high = "darkgreen")
causality_1[1]
head(causality_1[[2]])
```

Causality: Subgroups

```{r, comment=NA, fig.height=7, fig.width=11}
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

```{r, comment=NA}
revision <- with(pres_debates2012[1:20, ], dc_revision(dialogue, person))
revision[1]
revision[2]
```

Typology

```{r, comment=NA}
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*.

```{r, comment=NA}
## 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

```{r, comment=NA, fig.height=6, fig.width=6}
keyWords <- with(pres_debates2012, kwic(dialogue, list(time, person)))
plot(keyWords[[1]], high = "red")
```

```{r, comment=NA, fig.height=18, fig.width=11}
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]])
```