<jupyter_start><jupyter_text>需求：給一些文章，能不能夠擷取文本資料中重要的句子？ 思路： - 從文本資料中，針對文章進行評分，找出高訊息量的文章。 - 根據文章內容的句子進行評分，找出高訊息量的句子。<jupyter_code>import data
tabulation = data.tabulation(path='resource/csv/pubmed-sample.csv')
tabulation.read()
tabulation.table[['abstract', 'keyword']].head(10)
vocabulary = data.vocabulary(content=tabulation.table['abstract'], title=tabulation.table['title'])
vocabulary.build()
vocabulary.transform(mode='tf-idf')
print("term(row), document(column) matrix")
vocabulary.matrix
vocabulary.matrix.shape<jupyter_output><empty_output><jupyter_text>根據 TF-IDF 矩陣，計算每篇文章的訊息量，擷取出訊息量最高的 5 篇文章。<jupyter_code>k = 5
importance = data.importance(vocabulary=vocabulary)
document = importance.document(top=k)
document<jupyter_output><empty_output><jupyter_text>--- 針對第 k 篇文章，擷取出分數最高的 s 個句子。<jupyter_code>k = 1
s = 2
title = document['title'][k]
content = tabulation.table.loc[tabulation.table['title']==title]['abstract'].item()
sentence, _ = importance.sentence(title=title, content=content, top=s)
data.mark(title, content, sentence)<jupyter_output>[44mFunctional valvular incompetence in decompensated heart failure: noninvasive monitoring and response to medical management[0m
[33mObjective: We hypothesized that functional mitral and tricuspid valvular incompetence (MR and TR, respectively) are reversible causes of reduced cardiac output in decompensated heart failure (DF) that accompanies systolic dysfunction in ischemic or nonischemic cardiomyopathy.[0m
--------------------------------------------------<jupyter_text>--- 挑選第二篇來分析，擷取出分數最高的 s 個句子。<jupyter_code>k = 1
title = document['title'][k]
content = tabulation.table.loc[tabulation.table['title']==title]['abstract'].item()
sentence, _ = importance.sentence(title=title, content=content, top=3)
data.mark(title, content, sentence)<jupyter_output>[44mNeuropeptidomic analysis of the brain and thoracic ganglion from the Jonah crab, Cancer borealis[0m
Mass spectrometric methods were applied to determine the peptidome of the brain and thoracic ganglion of the Jonah crab (Cancer borealis). Fractions obtained by high performance liquid chromatography were characterized using MALDI-TOF MS and ESI-Q-TOF MS/MS. [33mIn total, 28 peptides were identified within the molecular mass range 750-3000Da.[0m [33mComparison of the molecular masses obtained with MALDI-TOF MS with the calculated molecular masses of known crustacean peptides revealed the presence of at least nine allatostatins, three orcokinin precursor derived peptides, namely FDAFTTGFGHS, [Ala(13)]-orcokinin, and [Val(13)]-orcokinin, and two kinins, a tachykinin-related peptide and four FMRFamide-related peptides.[0m [33mEight other peptides were de novo sequenced by collision induced dissociation on the Q-TOF system and yielded AYNRSFLRFamide, PELDHVFLRFamide or EPLDHVFLRFa[...]<jupyter_text>挑選第三篇來分析，擷取出分數最高的 3 個句子。<jupyter_code>k = 2
title = document['title'][k]
content = tabulation.table.loc[tabulation.table['title']==title]['abstract'].item()
sentence, _ = importance.sentence(title=title, content=content, top=3)
data.mark(title, content, sentence)<jupyter_output>[44m[Resection and Reconstruction of the Diaphragm and the Pericardium in Extrapleural Pneumonectomy][0m
The diaphragm dissection should be started from anterior, because the portion is just under the thoracotomy incision. The diaphragmatic muscle was cut by an electric knife along the line of 1 to 2 cm from the chest wall from anterior and lateral to posterior. The diaphragm including the tendon center is dissected from the peritoneum. The peritoneum should be preserved. If the peritoneum is opened, it should be repaired by sutures. The pericardium is opened at the apex. The pericardium incision is extended from the apex to cranial side. And then, it is cut from the apex to posterior with the diaphragm. And next, the incision of the cranial side edge is extended to posterior. The lower pulmonary vein, upper pulmonary vein, and pulmonary artery are exposed. They are encircled and divided in the pericardium by autosutures. A Goretex sheet with 1 mm thickness is used to reconstruct the[...]<jupyter_text>挑選第四篇來分析，擷取出分數最高的 3 個句子。<jupyter_code>k = 3
title = document['title'][k]
content = tabulation.table.loc[tabulation.table['title']==title]['abstract'].item()
sentence, _ = importance.sentence(title=title, content=content, top=3)
data.mark(title, content, sentence)<jupyter_output>[44mMagnocellular hypothalamic projections to the lower brain stem and spinal cord of the rat. Immunocytochemical evidence for predominance of the oxytocin-neurophysin system compared to the vasopressin-neurophysin system[0m
The paraventricular nucleus of the rat hypothalamus has been shown to project to the medulla and spinal cord. The proportion of oxytocin-neurophysin (OTNP) axons to vasopressin-neurophysin (VPNP) axons in these structures is unknown. A major difficulty in resolving this problem in previous immunocytochemical studies was the lack of a specific antiserum to each rat neurophysin. [33mIn this study two approaches have been used: (1) comparison of immunostaining for neurophysin in normal versus homozygous Brattleboro rats with diabetes insipidus (HODI) which lack VPNP, and (2) application of an antiserum to both rat neurophysins absorbed with HODI rat hypothalamic-pituitary extracts which contain only OTNP.[0m The latter would result in an antiserum specific for VPN[...]<jupyter_text>挑選第五篇來分析，擷取出分數最高的 3 個句子。<jupyter_code>k = 4
title = document['title'][k]
content = tabulation.table.loc[tabulation.table['title']==title]['abstract'].item()
sentence, _ = importance.sentence(title=title, content=content, top=3)
data.mark(title, content, sentence)<jupyter_output>[44mIntra-thoracic fibrous tissue induction by polylactic acid and epsilon-caprolactone copolymer cubes, with or without slow release of basic fibroblast growth factor[0m
[33mObjective: We investigated whether implantation of polylactic acid and epsilon-caprolactone copolymer (PLAC) cubes with or without basic fibroblast growth factor (b-FGF) released slowly from gelatin microspheres was able to induce fibrous tissue in the dead space remaining after pneumonectomy in the thoracic cavity.[0m
--------------------------------------------------
{'fraction_non_alphanumeric': 0.09867475650646655, 'fraction_numerical': 0.010697748682739901, 'mean_word_length': 6.062006764374296, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, '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}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '529095', 'license': 'Apache-2.0', 'n_tokens_mistral': 2177, 'n_tokens_neox': 1936, 'n_words': 644, 'path': 'HW/4-1/display.ipynb', 'repo_name': 'noname30081/IRR', 'size': '6263'}