本文整理汇总了Python中IPython.display.Markdown方法的典型用法代码示例。如果您正苦于以下问题:Python display.Markdown方法的具体用法?Python display.Markdown怎么用?Python display.Markdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPython.display
的用法示例。
在下文中一共展示了display.Markdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scatter_plot_intent_dist
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def scatter_plot_intent_dist(workspace_pd):
"""
takes the workspace_pd and generate a scatter distribution of the intents
:param workspace_pd:
:return:
"""
label_frequency = Counter(workspace_pd["intent"]).most_common()
frequencies = list(reversed(label_frequency))
counter_list = list(range(1, len(frequencies) + 1))
df = pd.DataFrame(data=frequencies, columns=["Intent", "Number of User Examples"])
df["Intent"] = counter_list
sns.set(rc={"figure.figsize": (15, 10)})
display(
Markdown(
'## <p style="text-align: center;">Sorted Distribution of User Examples \
per Intent</p>'
)
)
plt.ylabel("Number of User Examples", fontdict=LABEL_FONT)
plt.xlabel("Intent", fontdict=LABEL_FONT)
ax = sns.scatterplot(x="Intent", y="Number of User Examples", data=df, s=100)
示例2: print_markdown_table
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def print_markdown_table(headers, data):
'''
Renders table given headers and data
'''
md = ''
for h in headers:
md += '|' + h
md += '|\n'
for r in range(len(headers)):
md += '|---'
md += '|\n'
for row in data:
for element in row:
md += '|' + str(element)
md += '|\n'
display(Markdown(md))
示例3: display_observations
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def display_observations(self):
"""Display the current observations using IPython.display."""
for observation in self.observation_list.values():
display(Markdown(f"### {observation.caption}"))
display(Markdown(observation.description))
display(Markdown(f"Score: {observation.score}"))
if observation.link:
display(Markdown(f"[Go to details](#{observation.link})"))
if observation.tags:
display(Markdown(f'tags: {", ".join(observation.tags)}'))
display(observation.data)
if observation.additional_properties:
display(Markdown("### Additional Properties"))
for key, val in observation.additional_properties.items():
display(Markdown(f"**{key}**: {val}"))
示例4: generate_summary_statistics
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def generate_summary_statistics(data, entities_list=None):
"""
Take the workspace dictionary and display summary statistics regarding the workspace
:param data:
:param entities_list:
:return:
"""
total_examples = len(data["utterance"])
label_frequency = Counter(data["intent"]).most_common()
number_of_labels = len(label_frequency)
average_example_per_intent = np.average(list(dict(label_frequency).values()))
standard_deviation_of_intent = np.std(list(dict(label_frequency).values()))
characteristics = list()
characteristics.append(["Total User Examples", total_examples])
characteristics.append(["Unique Intents", number_of_labels])
characteristics.append(
["Average User Examples per Intent", int(np.around(average_example_per_intent))]
)
characteristics.append(
[
"Standard Deviation from Average",
int(np.around(standard_deviation_of_intent)),
]
)
if entities_list:
characteristics.append(["Total Number of Entities", len(entities_list)])
else:
characteristics.append(["Total Number of Entities", 0])
df = pd.DataFrame(data=characteristics, columns=["Data Characteristic", "Value"])
df.index = np.arange(1, len(df) + 1)
display(Markdown("### Summary Statistics"))
display(df)
示例5: show_user_examples_per_intent
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def show_user_examples_per_intent(data):
"""
Take the workspace dictionary and display summary statistics regarding the workspace
:param data:
:return:
"""
label_frequency = Counter(data["intent"]).most_common()
frequencies = list(reversed(label_frequency))
df = pd.DataFrame(data=frequencies, columns=["Intent", "Number of User Examples"])
df.index = np.arange(1, len(df) + 1)
display(Markdown("### Sorted Distribution of User Examples per Intent"))
display(df)
示例6: h1
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def h1(text):
display(Markdown('# %s' % text))
示例7: h2
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def h2(text):
display(Markdown('## %s' % text))
示例8: h3
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def h3(text):
display(Markdown('### %s' % text))
示例9: h4
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def h4(text):
display(Markdown('#### %s' % text))
示例10: print_md
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def print_md(string):
display(Markdown(string))
#@DeprecationWarning
示例11: help
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def help(self):
"""
Prints general help information, or specific usage information of a function if provided
:param function: an optional function
"""
from IPython.display import Markdown, display
def print_md(string):
display(Markdown(string))
# Check whether the request is for some specific function
#if function is not None:
# print_md(self.function.__doc__)
# If not then offer the general help menu
#else:
print_md("### Help Menu")
print_md("You can use the system through an **API** object. API objects are returned"
"by the *init_system* function, so you can get one by doing:")
print_md("***your_api_object = init_system('path_to_stored_model')***")
print_md("Once you have access to an API object there are a few concepts that are useful "
"to use the API. **content** refers to actual values of a given field. For "
"example, if you have a table with an attribute called __Name__ and values *Olu, Mike, Sam*, content "
"refers to the actual values, e.g. Mike, Sam, Olu.")
print_md("**schema** refers to the name of a given field. In the previous example, schema refers to the word"
"__Name__ as that's how the field is called.")
print_md("Finally, **entity** refers to the *semantic type* of the content. This is in experimental state. For "
"the previous example it would return *'person'* as that's what those names refer to.")
print_md("Certain functions require a *field* as input. In general a field is specified by the source name ("
"e.g. table name) and the field name (e.g. attribute name). For example, if we are interested in "
"finding content similar to the one of the attribute *year* in the table *Employee* we can provide "
"the field in the following way:")
print(
"field = ('Employee', 'year') # field = [<source_name>, <field_name>)")
示例12: test_append_display_data
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def test_append_display_data():
widget = widget_output.Output()
# Try appending a Markdown object.
widget.append_display_data(Markdown("# snakes!"))
expected = (
{
'output_type': 'display_data',
'data': {
'text/plain': '<IPython.core.display.Markdown object>',
'text/markdown': '# snakes!'
},
'metadata': {}
},
)
assert widget.outputs == expected, repr(widget.outputs)
# Now try appending an Image.
image_data = b"foobar"
image_data_b64 = image_data if sys.version_info[0] < 3 else 'Zm9vYmFy\n'
widget.append_display_data(Image(image_data, width=123, height=456))
expected += (
{
'output_type': 'display_data',
'data': {
'image/png': image_data_b64,
'text/plain': '<IPython.core.display.Image object>'
},
'metadata': {
'image/png': {
'width': 123,
'height': 456
}
}
},
)
assert widget.outputs == expected, repr(widget.outputs)
示例13: printmd
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def printmd(*args): # fixme: make it work without jupyter notebook
display(Markdown(" ".join(map(str, args))))
示例14: printmd
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def printmd(string):
'''
Renders markdown in notebook output of codecell
'''
display(Markdown(string))
示例15: display_source_code
# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def display_source_code(source_code, language='python'):
display(Markdown("```%s\n%s\n```" % (language, source_code)))