<commit_before>module Terms.Commands exposing (..)

import Http
import Json.Decode as Decode exposing (field)
import Terms.Models exposing (TermId, Term)
import Terms.Messages exposing (..)

fetchAll : Cmd Msg
fetchAll =
  Http.get fetchAllUrl collectionDecoder
    |> Http.send OnFetchAll

fetchAllUrl : String
fetchAllUrl =
  "http://0.0.0.0:9000/terms.json"

collectionDecoder : Decode.Decoder (List Term)
collectionDecoder =
  Decode.list memberDecoder

memberDecoder : Decode.Decoder Term
memberDecoder =
  Decode.map4 Term
    (field "id" Decode.string)
    (field "title" Decode.string)
    (field "description" Decode.string)
    (field "dbpedia_description" Decode.string)
<commit_msg>:construction: add create terms url<commit_after>module Terms.Commands exposing (..)

import Http
import Json.Decode as Decode exposing (field)
import Terms.Models exposing (TermId, Term)
import Terms.Messages exposing (..)

fetchAll : Cmd Msg
fetchAll =
  Http.get fetchAllUrl collectionDecoder
    |> Http.send OnFetchAll

fetchAllUrl : String
fetchAllUrl =
  "http://0.0.0.0:9000/terms.json"

createUrl : String
createUrl =
  "http://0.0.0.0:9000/terms.json"

collectionDecoder : Decode.Decoder (List Term)
collectionDecoder =
  Decode.list memberDecoder

memberDecoder : Decode.Decoder Term
memberDecoder =
  Decode.map4 Term
    (field "id" Decode.string)
    (field "title" Decode.string)
    (field "description" Decode.string)
    (field "dbpedia_description" Decode.string)

{'fraction_non_alphanumeric': 0.1035883547731889, 'fraction_numerical': 0.017603249830737983, 'mean_word_length': 4.413919413919414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6777913', 'n_tokens_mistral': 489, 'n_tokens_neox': 467, 'n_words': 122}