welfare-state-analytics / riksdagen-corpus

Swedish parliamentary proceedings - Riksdagens protokoll 1867-today
Other
26 stars 5 forks source link

A question related to the handling of prev/next pointers for unknown speeches. #138

Closed roger-mahler closed 2 years ago

roger-mahler commented 2 years ago

The sequence of unknown utterances seems to not be chained using prev/next pointers in many instances (see example below, actually all that I have seen). Since the prev/next pointers are used to aggregate speeches, the number of speeches explodes when every single utterance becomes a speech. The following segment prot-1958-b-fk--12 illustrates the problem.

A consequnce (for the notebooks pipeline) of not merging consequtive unknowns after a <note type=speaker tag is an increase of the number of speeches. Furthermore, the level of documents is systematically different; utterancefor unknown speakers but for known speakers documents are made up of a sequence of utterances.

Is this behavioisr by design or an issue that can be corrected in futute versions of the metadata?


          <note type="speaker" n="943c7f5c">
            Herr statsrådet SKOGLUND:
          </note>
          <u who="unknown" xml:id="i-78bdc01fc4afc670-4" n="78bdc01f">
            <seg n="e28df327">
              Herr talman! Med anledning av herr Bergs fråga vill jag försäkra
              honom, att jag är minst lika intresserad som han av att 1953 års
              trafikutredning kan slutföra sitt arbete så snabbt som det över
              huvud taget är möjligt. Vi skall emellertid komma ihåg, att det
              är en synnerligen besvärlig materia, utredningen har att handskas
            </seg>
          </u>
          <pb n="18" facs="https://betalab.kb.se/prot-1958-b-fk--12/prot_1958_b_fk__12-018.jp2/_view"/>
          <note type="date" n="c3756f8a">
            Onsdagen den 26 november 1958 fm.
          </note>
          <note n="7e5b6b0f">
            Nr B 12 19
          </note>
          <u who="unknown" xml:id="i-78bdc01fc4afc670-5" n="78bdc01f">
            <seg n="f2157377">
              Ang. trafiken på järnvägen Karlskrona—Torsås-—Kalmar
            </seg>
            <seg n="7fbadf2a">
              med. Därför kommer det med nödvändighet att ta tid, innan utredningen
              kan framlägga ett betänkande med förslag eller delar av ett sådant.
            </seg>
            <seg n="39f94d53">
              I syfte att göra det möjligt för utredningen att arbeta i raskare
              tempo än eljest skulle kunnat ske lät jag för mer än ett år sedan
              förstärka dess sekretariat på det sätt som kunde anses nödvändigt
              för att utredningsarbetet skulle fortgå skyndsammare. Jag tror
              också att det skall vara möjligt för utredningen att framlägga
              ett första betänkande mot sluiet av 1959; på den punkten måste
              jag dock yttra mig med all reservation, eftersom materialet, jag
              upprepar det, är svårhanterligt och frågan vansklig att bedöma
              på längre sikt. Jag hoppas emellertid alltså för min del, att
              utredningen skall kunna avlämna ett betänkande under 1959 och
              att vi därigenom också skall få möjligheter till en klarare bedömning
              av trafikpolitikens framtida utformning.
            </seg>
          </u>
rbbby commented 2 years ago

Great that you are bringing this up. I am not expert on the schema and @ninpnin who designed it is sick atm. But it seems like this is something we may want to correct.

When doing topic modelling on the corpus I have so far used the speech_iterator function from the pyparlaclarin package. The function has been updated to work for 0.4.X version of the corpus, but it is not yet in the module. I added an example of how I gather concatenated speeches with the updated function below, as well as an example of how to get metadata for unknown speakers.

https://github.com/welfare-state-analytics/riksdagen-corpus/blob/dev/examples/corpus-walkthrough.ipynb

ninpnin commented 2 years ago

Fixed.

ninpnin commented 2 years ago

I.e., now speeches where the speaker is unknown are linked with next and prev attributes, too.