本文整理匯總了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)))