Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
clean-up

Jiho Noh romanegloo

😀
clean-up
  • University of Kentucky
  • Lexington, KY
View GitHub Profile
View fib.md

(Note. If you missed the "Python Primer" lab and you have no Python experience, please come to Jiho's office hours. We can do this together.)

Fibonacci numbers are defined recursively as below:

f(0) = 0, f(1) = 1
f(n) = f(n-1) + f(n-2)

Implement a fibonacci function fib(n), and use it to print out the Fibonacci numbers where n ranges from 0 to 9 such as:

View uts_api_client.py
""" UTS (UMLS Terminology Services) API client """
import json
from pathlib import Path
import requests
from lxml.html import fromstring
class UtsClient:
"""All the UTS REST API requests are handled through this client"""
def __init__(self, apikey=None):
@romanegloo
romanegloo / cui2mesh.py
Created Sep 6, 2019
Find corresponding MeSH terms from CUIs in evaluation datasets
View cui2mesh.py
#!/usr/bin/env python3
# pylint: disable=invalid-name
"""Reads UMNSRS datasets where CUIs are used, add corresponding MeSHes to the
CUIs"""
from pathlib import Path
import csv
from tqdm import tqdm
from BMET.uts_api_client import UtsClient
@romanegloo
romanegloo / build_ES_pubtator_index.py
Created Sep 5, 2019
build_ES_pubtator_index: Building ElasticSearch Index of PubTator
View build_ES_pubtator_index.py
#!/usr/bin/env python3
"""
Parse PubTator raw data file, and creates ElasticSearch index, and populate the
corpus (index: 'pubtator')
You can download PubTator dataset from the following link:
ftp://ftp.ncbi.nlm.nih.gov/pub/lu/PubTator/bioconcepts2pubtator_offsets.gz
Place the file in 'data/' and run this code. Don't need to decompress the file.
We assume that ElasticSearch is properly installed and accessible via its API
@romanegloo
romanegloo / script_gen_pubtator_db.py
Created Aug 30, 2019
A script that reads MeSH descriptors and PubTator doc data from data files and create SQLite database to store the encoded docs for later training uses. (deprecated)
View script_gen_pubtator_db.py
#!/usr/bin/env python3
"""Preprocess PubTator corpus and ScopeNotes of MeSH descriptors for language
model training (LmBMET).
1) Given the original PubTator biocepts annotated documents, this interpolates
the concept codes into document texts. Before that, this will count word
frequencies and generate vocabulary which will include the entire set of
bioconcepts (MeSH in particular). In case that a pre-trained embeddings file
(.vec) is provided, we obtain a vocabulary from the embeddings.
View coverage_eval_terms.py
import csv
import sqlite3
eval_file = "data/eval/MayoSRS_mesh.csv"
db_file = "data/pubtator/pubtator-20190725-6496be10.db"
words = []
with open(eval_file) as f:
csv_reader = csv.DictReader(f)
for row in csv_reader:
View ukycs215_lab8.md

Lab 08

instruction note (lab8)

Lab 9 is canceled (lab 8 is extended by a week)

Reviews

  1. include contact.h from contactList.h. Use double quotation marks
  2. #pragma once tells the compiler to include the source code only once
View ukycs215_lab7.md
View ukycs215_lab5.md

Lab 05

Lab 05 instruction

Easiest so far!!!

Checklist

  • menu option is single char
  • use do-while for the menu loop
View ukycs215_lab4.md

Lab04

Objectives

  • read input temperatures by day
  • write summarization in an output file

from tempin.txt

01/24/2019 5 22 27 31 26 19
01/25/2019 8 20 25 30 35 40 38 32 29