EmmaSchwarz / computational-dostoevsky

1 stars 0 forks source link

Total length in characters of all of G's speech #22

Open djbpitt opened 4 years ago

djbpitt commented 4 years ago
//speech[@speaker eq 'gol'][@addressee] 
    ! normalize-space(.) 
    ! string-length(.)
    => sum()
  1. Find all speeches
  2. Filter them to keep only those by G
  3. Filter those to keep only those that have an addressee (up until here, you are returning a sequence of <speech> elements
  4. Normalize the whitespace for each of those (at this point, you are returning a sequence of strings)
  5. Get the string length (character count) of each of them after whitespace-normalization (now you are returning a sequence of integers)
  6. Add up all of the lengths using sum()