System.Collections.Generic.List.Add(sentence)

Here are the examples of the csharp api System.Collections.Generic.List.Add(sentence) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

19 View Source File : ExporterDta2017.cs
License : GNU Affero General Public License v3.0
Project Creator : notesjor

private DSpin GetDSpin(IHydra hydra, Guid guid, int i)
    {
      var meta = hydra.GetDoreplacedentMetadata(guid);

      var from = meta != null && meta.ContainsKey(MetanameAuthor)
        ? meta[MetanameAuthor].ToString()
        : UnknownPropertyValue;
      var datum = meta != null && meta.ContainsKey(MetanameDate)
        ? meta[MetanameDate] is DateTime
          ? ((DateTime) meta[MetanameDate]).ToString("yyyy-MM-dd")
          : meta[MetanameDate].ToString()
        : UnknownDateValue;

      var docW = hydra.GetReadableDoreplacedent(guid, LayernameWord).Select(x => x.ToArray()).ToArray();
      // Die folgenden Layer sind optional
      var docL = hydra.GetReadableDoreplacedent(guid, LayernameLemma)?.Select(x => x.ToArray()).ToArray();
      var docP = hydra.GetReadableDoreplacedent(guid, LayernamePos)?.Select(x => x.ToArray()).ToArray();
      var docO = hydra.GetReadableDoreplacedent(guid, "Orthografie")?.Select(x => x.ToArray()).ToArray();

      var text = new StringBuilder();
      var tokens = new List<token>();
      var lemmas = new List<lemma>();
      var tags = new List<tag>();
      var sents = new List<sentence>();
      var orthos = new List<correction>();

      var id = 1;

      for (var j = 0; j < docW.Length; j++)
      {
        var sent = new StringBuilder();
        for (var k = 0; k < docW[j].Length; k++)
        {
          var iD = "t" + id++;
          sent.AppendFormat(" {0}", iD);
          tokens.Add(new token {ID = iD, Text = new[] {docW[j][k]}});
          if (docL != null)
            lemmas.Add(new lemma {tokenIDs = iD, Text = new[] {docL[j][k]}});
          if (docP != null)
            tags.Add(new tag {tokenIDs = iD, Text = new[] {docP[j][k]}});
          if (docO != null)
            orthos.Add(new correction {tokenIDs = iD, Text = new[] {docO[j][k]}, operation = "replace"});

          if (docW[j][k].Length > 1)
            text.Append(" ");
          text.Append(docW[j][k]);
        }

        sents.Add(new sentence {tokenIDs = sent.ToString().Trim(), ID = "s" + j});
      }

      return new DSpin
      {
        MetaData = new source
        {
          source1 = new CMD
          {
            CMD1 = new CMD1
            {
              Header = new Header
              {
                MdCreator = "CorpusExplorer",
                MdProfile = $"corpusexplorer.de:guid:{guid.ToString("N")}",
                MdCollectionDisplayName = "CorpusExplorer.de",
                MdCreationDate = DateTime.Now.ToString(),
                MdSelfLink = "http://www.corpusExplorer.de"
              },
              CMDVersion = "1.2",
              Components = new teiHeader
              {
                teiHeader1 = new teiHeader1
                {
                  encodingDesc = new editorialDecl
                  {
                    editorialDecl1 = new[] {""}
                  },
                  fileDesc = new fileDesc
                  {
                    replacedleStmt = new replacedleStmt
                    {
                      author =
                        new author
                        {
                          persName = new persName {addName = from}
                        }
                    }
                  }
                }
              }
            }
          }
        },
        version = "0.4",
        TextCorpus =
          new TextCorpus
          {
            lang = CorpusLanguage,
            tokens = tokens.ToArray(),
            lemmas = docL == null ? null : lemmas.ToArray(),
            orthography = docO == null ? null : orthos.ToArray(),
            POStags = docP == null ? null : new POStags {tag = tags.ToArray(), tagset = CorpusTagset},
            sentences = sents.ToArray()
          }
      };
    }

19 View Source File : ExporterWeblicht.cs
License : GNU Affero General Public License v3.0
Project Creator : notesjor

private DSpin GetDSpin(IHydra hydra, Guid guid, int i)
    {
      var docW = hydra.GetReadableDoreplacedent(guid, LayernameWord).Select(x => x.ToArray()).ToArray();
      // Die folgenden Layer sind optional
      var docL = hydra.GetReadableDoreplacedent(guid, LayernameLemma)?.Select(x => x.ToArray()).ToArray();
      var docP = hydra.GetReadableDoreplacedent(guid, LayernamePos)?.Select(x => x.ToArray()).ToArray();

      var text = new StringBuilder();
      var tokens = new List<token>();
      var lemmas = new List<lemma>();
      var tags = new List<tag>();
      var sents = new List<sentence>();

      var id = 1;

      var lId = 1;

      for (var j = 0; j < docW.Length; j++)
      {
        var sent = new StringBuilder();
        for (var k = 0; k < docW[j].Length; k++)
        {
          var iD = "t" + id++;
          sent.AppendFormat(" {0}", iD);
          tokens.Add(new token { ID = iD, Text = docW[j][k] });
          if (docL != null)
            lemmas.Add(new lemma { ID = "" + lId++, tokenIDs = iD, Text = docL[j][k] });
          if (docP != null)
            tags.Add(new tag { tokenIDs = iD, Text = docP[j][k] });

          if (docW[j][k].Length > 1)
            text.Append(" ");
          text.Append(docW[j][k]);
        }

        sents.Add(new sentence { tokenIDs = sent.ToString().Trim(), ID = "s" + j });
      }

      return new DSpin
      {
        version = (decimal)0.4,
        TextCorpus =
          new TextCorpus
          {
            text = hydra.GetReadableDoreplacedent(guid, "Wort").ReduceDoreplacedentToText(),
            lang = CorpusLanguage,
            tokens = tokens.ToArray(),
            lemmas = docL == null ? null : lemmas.ToArray(),
            POStags = docP == null ? null : new POStags { tag = tags.ToArray(), tagset = CorpusTagset },
            sentences = sents.ToArray()
          }
      };
    }

19 View Source File : ExporterSlashA.cs
License : GNU Affero General Public License v3.0
Project Creator : notesjor

private DSpin GetDSpin(IHydra hydra, Guid guid, int i)
    {
      var meta = hydra.GetDoreplacedentMetadata(guid);

      var from = meta != null && meta.ContainsKey(MetanameAuthor)
        ? meta[MetanameAuthor].ToString()
        : UnknownPropertyValue;
      var datum = meta != null && meta.ContainsKey(MetanameDate)
        ? meta[MetanameDate] is DateTime
          ? ((DateTime) meta[MetanameDate]).ToString("yyyy-MM-dd")
          : meta[MetanameDate].ToString()
        : UnknownDateValue;
      var to = meta != null && meta.ContainsKey(MetanamePublishingLocation)
        ? meta[MetanamePublishingLocation].ToString()
        : meta != null && meta.ContainsKey(MetanameReciver)
          ? meta[MetanameReciver].ToString()
          : UnknownPropertyValue;

      var docW = hydra.GetReadableDoreplacedent(guid, LayernameWord).Select(x => x.ToArray()).ToArray();
      var docL = hydra.GetReadableDoreplacedent(guid, LayernameLemma).Select(x => x.ToArray()).ToArray();
      var docP = hydra.GetReadableDoreplacedent(guid, LayernamePos).Select(x => x.ToArray()).ToArray();

      var text = new StringBuilder();
      var tokens = new List<token>();
      var lemmas = new List<lemma>();
      var tags = new List<tag>();
      var sents = new List<sentence>();

      var id = 1;
      for (var j = 0; j < docW.Length; j++)
      {
        var sent = new StringBuilder();
        for (var k = 0; k < docW[j].Length; k++)
        {
          var iD = "t_" + id++;
          sent.AppendFormat(" {0}", iD);
          tokens.Add(new token {ID = iD, Text = new[] {docW[j][k]}});
          lemmas.Add(new lemma {tokenIDs = iD, Text = new[] {docL[j][k]}});
          tags.Add(new tag {tokenIDs = iD, Text = new[] {docP[j][k]}});
          if (docW[j][k].Length > 1)
            text.Append(" ");
          text.Append(docW[j][k]);
        }

        sents.Add(new sentence {tokenIDs = sent.ToString().Trim()});
      }

      return new DSpin
      {
        MetaData =
          new MetaData
          {
            vistola = new vistola
            {
              correspondence = new correspondence {from = from, to = to},
              dates =
                new dates
                {
                  date =
                    new date
                    {
                      calculated = new calculated {date = datum},
                      rough = new rough {date = datum},
                      written = new written {date = datum},
                      window = new window {sdate = datum, edate = datum}
                    }
                },
              editor = new editor {initials = ""},
              number = new number {letter = i.ToString(), volume = "v1"},
              postmark = new postmark {date = datum}
            }
          },
        version = (decimal) 2.0,
        TextCorpus =
          new TextCorpus
          {
            lang = CorpusLanguage,
            text = text.ToString().Trim(),
            tokens = tokens.ToArray(),
            lemmas = lemmas.ToArray(),
            namedEnreplacedies = new namedEnreplacedies {type = CorpusEnreplacediesType, enreplacedy = new enreplacedy[0]},
            POStags =
              new POStags
              {
                tagset = CorpusTagset,
                tag = tags.ToArray()
              },
            sentences = sents.ToArray()
          }
      };
    }