Output COMBO results to an Excel file

26 views
Skip to first unread message

Nick Riches

unread,
Aug 15, 2018, 5:47:47 AM8/15/18
to chibolts
Hi

I'm trying to output the results of a COMBO search to an Excel file (e.g. with one column for a file identifier, another column for the participant, a third column the speaker tier, and a fourth column for the MOR tier). I understand that many commands have switches which allow output to a spreadsheet format, but I cannot find an equivalent for the COMBO command. Is there one?

Thanks

Davida Fromm

unread,
Aug 15, 2018, 9:06:06 AM8/15/18
to chib...@googlegroups.com
Dear Nick,

Did you try the +d6 switch?  You can always see a list and explanation of the options and switches if you just type the command (in this case, combo) in the command window and then hit return. 

Hope that helps,
Davida


--
You received this message because you are subscribed to the Google Groups "chibolts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chibolts+unsubscribe@googlegroups.com.
To post to this group, send email to chib...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chibolts/989cf490-ee50-49f2-943e-ad24b43200fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nick Riches

unread,
Aug 16, 2018, 3:24:53 AM8/16/18
to chibolts
Thanks for the reply

For COMBO, the +d switches only go from 1 - 5, so it doesn't look as if this will work.

Best wishes

Nick


On Wednesday, August 15, 2018 at 2:06:06 PM UTC+1, Davida wrote:
Dear Nick,

Did you try the +d6 switch?  You can always see a list and explanation of the options and switches if you just type the command (in this case, combo) in the command window and then hit return. 

Hope that helps,
Davida

On Wed, Aug 15, 2018 at 5:47 AM, Nick Riches <nick....@gmail.com> wrote:
Hi

I'm trying to output the results of a COMBO search to an Excel file (e.g. with one column for a file identifier, another column for the participant, a third column the speaker tier, and a fourth column for the MOR tier). I understand that many commands have switches which allow output to a spreadsheet format, but I cannot find an equivalent for the COMBO command. Is there one?

Thanks

--
You received this message because you are subscribed to the Google Groups "chibolts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chibolts+u...@googlegroups.com.

Davida Fromm

unread,
Aug 16, 2018, 8:16:16 AM8/16/18
to chib...@googlegroups.com
Nick,

Is it possible you're using an older version of CLAN (the date should appear in the lower left corner of the Commands window next to the Recall button)?  Consider downloading a new version and you should see the option and it should work.  

-Davida

To unsubscribe from this group and stop receiving emails from it, send an email to chibolts+unsubscribe@googlegroups.com.

To post to this group, send email to chib...@googlegroups.com.

Nick Riches

unread,
Aug 16, 2018, 11:09:36 AM8/16/18
to chibolts
Thanks - very simple!

I now have the +d6 switch. But it doesn't quite do what I am looking for, as it doesn't list each individual utterance in the database for checking

Nick
-Davida

Davida Fromm

unread,
Aug 16, 2018, 11:26:12 AM8/16/18
to chib...@googlegroups.com
Nick,

Right, +d6 gives you # of matches in a spreadsheet but without the individual utterance.  You will probably have to use one of the other +d options (probably 1, 2, or 3) to check individual utterances.  You can always consider copying and pasting that output to a spreadsheet (or another tab your other combo results spreadsheet).

-Davida


To unsubscribe from this group and stop receiving emails from it, send an email to chibolts+unsubscribe@googlegroups.com.

To post to this group, send email to chib...@googlegroups.com.

Nick Riches

unread,
Sep 12, 2018, 2:54:16 AM9/12/18
to chibolts
Hi

I've just written an R script which will do this. The output of the 'combo' command should be saved as a text file. The script reads this interactively using the 'scan' function. The tidyverse needs to be loaded (dplyr commands are used)

Here's the script:



# Read in data interactively. File should be a text file.

options(stringsAsFactors = FALSE)

script <- scan(file.choose(), what = "string", sep = "\n")

df <- as.data.frame(script)

# Create variable for type of line, e.g. "utt" = UTTERANCE, "mor" = MOR

df$type <- ""

# Function for identifying 'mor' line (by searching for downpipes)

has_downpipe <- function(string){
  return(grepl("[\x7C]" , string))
}

library(tidyverse)

# Create variable showing line type (e.g. is it the 'mor' tier?)

for(i in 1:nrow(df)){
  if(substr(df$script[i], 1, 8) == "*** File"){df$type[i] <- "file"}
  if((substr(df$script[i], 1, 1) == "*") &
    (substr(df$script[i], 5, 5) == ":")){df$type[i] <- "utt"}
  if(has_downpipe(df$script[i])){df$type[i] <- "mor"}
}

# Fill down 'utt' (utterance over more than one line)

for(i in 2:nrow(df)){
  if(df$type[i] == "" & df$type[i - 1] == "utt"){df$type[i] == "utt"}
}

# Remove non-essential lines and rename rows

df <- df[which(df$type != ""),]
row.names(df) <- seq(1, nrow(df))

# Create variable for filename

df$file <- ""

for(i in 1:nrow(df)){
  if(df$type[i] == "file"){
    vector <- unlist(gregexpr("[\x22]", df$script[i]))
    start <- vector[1] + 1
    stop <- vector[2] - 1
    df$file[i] <- substr(df$script[i], start, stop)
  }
}

# Create variables of utterance and mor line

df$utt <- ""
df$mor <- ""

file_row <- 1

for(i in 1:nrow(df)){
  if(df$type[i] == "file"){file_row <- i}
  if(df$type[i] == "utt"){df$utt[file_row] <- paste(df$utt[file_row], df$script[i])}
  if(df$type[i] == "mor"){df$mor[file_row] <- paste(df$mor[file_row], df$script[i])}
}

# Remove blank lines and rename rows

df <- df[which(df$file != ""),]
row.names(df) <- seq(1, nrow(df))

# Drop unnecessary variables

df <- df %>% select(file, utt, mor)

Reply all
Reply to author
Forward
0 new messages