<commit_before>import R from 'ramda';

import splitByClass from '../../utils/splitByClass/splitByClass';
import extractHeadword from '../extractHeadword/extractHeadword';
import extractPronunciation from '../extractPronunciation/extractPronunciation';
import composeEntryData from '../composeEntryData/composeEntryData';

const composeWordData = pageMarkup => {
  const wordData = R.zipObj(
    [
      'headword',
      'pronunciation',
      'entries'
    ],
    [
      extractHeadword(pageMarkup),
      extractPronunciation(pageMarkup),
      R.pipe(
        splitByClass('ldoceEntry'),
        R.map(composeEntryData)
      )(pageMarkup)
    ]
  );

  return wordData;
 }

export default composeWordData;
<commit_msg>refactor: composeWordData<commit_after>import R from 'ramda';
import splitByClass from '../../utils/splitByClass/splitByClass';
import extractHeadword from '../extractHeadword/extractHeadword';
import extractPronunciation from '../extractPronunciation/extractPronunciation';
import composeEntryData from '../composeEntryData/composeEntryData';

const composeWordData = pageMarkup => {
  const headword = extractHeadword(pageMarkup);
  const pronunciation = extractPronunciation(pageMarkup);
  const entries = R.pipe(
    splitByClass('ldoceEntry'),
    R.map(composeEntryData)
  )(pageMarkup);

  const wordData = {
    headword,
    pronunciation,
    entries
  };

  return wordData;
 }

export default composeWordData;

{'fraction_non_alphanumeric': 0.10865051903114187, 'fraction_numerical': 0.0, 'mean_word_length': 4.239130434782608, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '7578980', 'n_tokens_mistral': 442, 'n_tokens_neox': 421, 'n_words': 86}