text:
package im.actor.messenger.app.fragment.settings;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.Toast;

import im.actor.messenger.R;
import im.actor.messenger.app.fragment.BaseFragment;
import im.actor.messenger.app.view.KeyboardHelper;
import im.actor.model.concurrency.CommandCallback;
import im.actor.model.viewmodel.GroupVM;
import im.actor.model.viewmodel.UserVM;

import static im.actor.messenger.app.Core.groups;
import static im.actor.messenger.app.Core.messenger;
import static im.actor.messenger.app.Core.myUid;
import static im.actor.messenger.app.Core.users;

/**
 * Created by ex3ndr on 25.10.14.
 */
public class EditNameFragment extends BaseFragment {

    public static EditNameFragment editName(int type, int id) {
        Bundle args = new Bundle();
        args.putInt("EXTRA_TYPE", type);
        args.putInt("EXTRA_ID", id);
        EditNameFragment res = new EditNameFragment();
        res.setArguments(args);
        return res;
    }

    private KeyboardHelper helper;
    private EditText nameEdit;

    private int type;
    private int id;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        type = getArguments().getInt("EXTRA_TYPE");
        id = getArguments().getInt("EXTRA_ID");

        helper = new KeyboardHelper(getActivity());
        View res = inflater.inflate(R.layout.fragment_edit_name, container, false);
        nameEdit = (EditText) res.findViewById(R.id.nameEdit);
        if (type == EditNameActivity.TYPE_ME) {
            UserVM userModel = users().get(myUid());
            nameEdit.setText(userModel.getName().get());
        } else if (type == EditNameActivity.TYPE_USER) {
            UserVM userModel = users().get(id);
            nameEdit.setText(userModel.getName().get());
        } else if (type == EditNameActivity.TYPE_GROUP) {
            GroupVM group = groups().get(id);
            nameEdit.setText(group.getName().get());
        }
        res.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });
        res.findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name = nameEdit.getText().toString().trim();
                if (name.length() == 0) {
                    Toast.makeText(getActivity(), R.string.toast_empty_name, Toast.LENGTH_SHORT).show();
                    return;
                }

                if (type == EditNameActivity.TYPE_ME) {
                    execute(messenger().editMyName(name), R.string.edit_name_process, new CommandCallback<Boolean>() {
                        @Override
                        public void onResult(Boolean res) {
                            getActivity().finish();
                        }

                        @Override
                        public void onError(Exception e) {
                            Toast.makeText(getActivity(), R.string.toast_unable_change, Toast.LENGTH_SHORT).show();
                        }
                    });
                } else if (type == EditNameActivity.TYPE_USER) {
                    execute(messenger().editName(id, name), R.string.edit_name_process, new CommandCallback<Boolean>() {
                        @Override
                        public void onResult(Boolean res) {
                            getActivity().finish();
                        }

                        @Override
                        public void onError(Exception e) {
                            Toast.makeText(getActivity(), R.string.toast_unable_change, Toast.LENGTH_SHORT).show();
                        }
                    });
                } else if (type == EditNameActivity.TYPE_GROUP) {
                    execute(messenger().editGroupTitle(id, name), R.string.edit_name_process, new CommandCallback<Boolean>() {
                        @Override
                        public void onResult(Boolean res) {
                            getActivity().finish();
                        }

                        @Override
                        public void onError(Exception e) {
                            Toast.makeText(getActivity(), R.string.toast_unable_change, Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            }
        });
        return res;
    }

    @Override
    public void onResume() {
        super.onResume();
        nameEdit.requestFocus();
        helper.setImeVisibility(nameEdit, true);
    }

    @Override
    public void onPause() {
        super.onPause();
        helper.setImeVisibility(nameEdit, false);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        helper = null;
    }
}


text:
package com.intellij.spring.model.converters;

import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.psi.*;
import com.intellij.spring.model.xml.DomSpringBean;
import com.intellij.spring.model.xml.beans.LookupMethod;
import com.intellij.spring.model.xml.beans.SpringBeanPointer;
import com.intellij.util.xml.ConvertContext;
import com.intellij.util.xml.GenericDomValue;
import com.intellij.codeInsight.daemon.impl.quickfix.CreateMethodQuickFix;
import org.jetbrains.annotations.NonNls;
import javax.annotation.Nonnull;

import java.util.ArrayList;
import java.util.List;

// 3.3.8.1. Lookup method injection
public class SpringBeanLookupMethodConverter extends SpringBeanMethodConverter {

  protected boolean checkModifiers(final PsiMethod method) {
    return method.hasModifierProperty(PsiModifier.PUBLIC) || method.hasModifierProperty(PsiModifier.PROTECTED);
  }

  protected boolean checkReturnType(final ConvertContext context, final PsiMethod method, final boolean forCompletion) {
    final PsiType returnType = method.getReturnType();
    if (PsiType.VOID.equals(returnType) || returnType instanceof PsiPrimitiveType) return false;

    if (forCompletion) {
      final PsiClass[] possibleReturnTypes = getValidReturnTypes(context);
      if (possibleReturnTypes.length > 0 && returnType != null) {
        for (PsiClass possibleReturnType : possibleReturnTypes) {
          final PsiClassType classType = JavaPsiFacade.getInstance(possibleReturnType.getProject()).getElementFactory().createType(possibleReturnType);
          if(classType.isAssignableFrom(returnType)) return true;
        }
        return false;
      }
    }
    return super.checkReturnType(context, method, forCompletion);
  }

  public LocalQuickFix[] getQuickFixes(final ConvertContext context) {
    final PsiClass[] validReturnTypes = getValidReturnTypes(context);
    if (validReturnTypes.length == 0) return LocalQuickFix.EMPTY_ARRAY;

    final DomSpringBean springBean = SpringConverterUtil.getCurrentBean(context);
    final GenericDomValue element = (GenericDomValue)context.getInvocationElement();
    final String elementName = element.getStringValue();
    final PsiClass psiClass = springBean.getBeanClass();

    final List<LocalQuickFix> fixes = new ArrayList<LocalQuickFix>();
    for (final PsiClass returnType : validReturnTypes) {
      if(elementName != null && elementName.length() > 0) {
        CreateMethodQuickFix fix =
          CreateMethodQuickFix.createFix(psiClass, getNewMethodSignature(elementName, returnType), getNewMethodBody());
        if (fix != null) {
          fixes.add(fix);
        }
      }
    }

    return fixes.toArray(new LocalQuickFix[fixes.size()]);
  }

  @NonNls
  private static String getNewMethodBody() {
    return "return null;";
  }

  @NonNls
  private static String getNewMethodSignature(@Nonnull final String elementName, @Nonnull final PsiClass psiClass) {
    return "public " + psiClass.getQualifiedName() + " " + elementName + "()";
  }

  @Nonnull
  private static PsiClass[] getValidReturnTypes(final ConvertContext context) {
    final LookupMethod lookupMethod = context.getInvocationElement().getParentOfType(LookupMethod.class, false);
    if (lookupMethod != null) {
      final SpringBeanPointer beanPointer = lookupMethod.getBean().getValue();
      if (beanPointer != null) {
        return beanPointer.getEffectiveBeanType();
      }
    }
    return PsiClass.EMPTY_ARRAY;
  }
}

redpajama_set_name: RedPajamaGithub


text:
module DeviseHelper
  def devise_error_messages!
    return "" if resource.errors.empty?

    messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
    sentence = I18n.t("errors.messages.not_saved",
                      count: resource.errors.count,
        resource: resource.class.model_name.human.downcase)

    html = <<-HTML

      <button type="button" class="close" data-dismiss="alert">
        x
      </button>

        #{messages}

    HTML

    html.html_safe
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>TextVectorizer</title>
<meta name="date" content="2016-09-19">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.deeplearning4j.bagofwords.vectorizer

Interface TextVectorizer

All Superinterfaces:

java.io.Serializable, Vectorizer

All Known Implementing Classes:

BagOfWordsVectorizer, BaseTextVectorizer, TfidfVectorizer

public interface TextVectorizer
extends Vectorizer

Vectorizes text

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

void
fit()

Train the model

InvertedIndex<VocabWord>
getIndex()

Inverted index

VocabCache<VocabWord>
getVocabCache()

The vocab sorted in descending order

long
numWordsEncountered()

Returns the number of words encountered so far

INDArray
transform(java.lang.String text)

Transforms the matrix

DataSet
vectorize(java.io.File input,
         java.lang.String label)

DataSet
vectorize(java.io.InputStream is,
         java.lang.String label)

Text coming from an input stream considered as one document

DataSet
vectorize(java.lang.String text,
         java.lang.String label)

Vectorizes the passed in text treating it as one document

Methods inherited from interface org.deeplearning4j.datasets.vectorizer.Vectorizer

vectorize

Method Detail

getVocabCache

VocabCache<VocabWord> getVocabCache()

The vocab sorted in descending order

Returns:

the vocab sorted in descending order

vectorize

DataSet vectorize(java.io.InputStream is,
                  java.lang.String label)

Text coming from an input stream considered as one document

Parameters:

is - the input stream to read from

label - the label to assign

Returns:

a dataset with a applyTransformToDestination of weights(relative to impl; could be word counts or tfidf scores)

vectorize

DataSet vectorize(java.lang.String text,
                  java.lang.String label)

Vectorizes the passed in text treating it as one document

Parameters:

text - the text to vectorize

label - the label of the text

Returns:

a dataset with a transform of weights(relative to impl; could be word counts or tfidf scores)

fit

void fit()

Train the model

vectorize

DataSet vectorize(java.io.File input,
                  java.lang.String label)

Parameters:

input - the text to vectorize

label - the label of the text

Returns:

DataSet with a applyTransformToDestination of
          weights(relative to impl; could be word counts or tfidf scores)

transform

INDArray transform(java.lang.String text)

Transforms the matrix

Parameters:

text - text to transform

Returns:

INDArray

numWordsEncountered

long numWordsEncountered()

Returns the number of words encountered so far

Returns:

the number of words encountered so far

getIndex

InvertedIndex<VocabWord> getIndex()

Inverted index

Returns:

the inverted index for this vectorizer

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
@implementation CCPackageHelper

+ (NSString *)currentOS
{
#if __CC_PLATFORM_ANDROID
    return @"Android";
#elif __CC_PLATFORM_MAC || __CC_PLATFORM_IOS
    return @"iOS";
#endif
    return nil;
}

+ (NSString *)cachesFolder
{
    #if __CC_PLATFORM_MAC
    NSString *cachesFolderPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
    NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
    return [cachesFolderPath stringByAppendingPathComponent:bundleIdentifier];
    #else
    return [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
    #endif
}

+ (NSString *)ccFileUtilsSuffixToResolution:(NSString *)suffix
{
    if ([suffix isEqualToString:CCFileUtilsSuffixiPhone5HD]
        || [suffix isEqualToString:CCFileUtilsSuffixiPhone5]
        || [suffix isEqualToString:CCFileUtilsSuffixiPhoneHD]
        || [suffix isEqualToString:CCFileUtilsSuffixDefault])
    {
        return @"phonehd";
    }

    if ([suffix isEqualToString:CCFileUtilsSuffixiPhone])
    {
        return @"phone";
    }

    if ([suffix isEqualToString:CCFileUtilsSuffixiPadHD]
        || [suffix isEqualToString:CCFileUtilsSuffixMacHD])
    {
        return @"tablethd";
    }

    if ([suffix isEqualToString:CCFileUtilsSuffixMac]
        || [suffix isEqualToString:CCFileUtilsSuffixiPad])
    {
        return @"tablet";
    }

    return nil;
}

+ (NSString *)defaultResolution
{
    for (NSString *resolution in [CCFileUtils sharedFileUtils].searchResolutionsOrder)
    {
        NSString *result = [CCPackageHelper ccFileUtilsSuffixToResolution:resolution];
        if (result)
        {
            return result;
        }
    }

    return @"phonehd";
}

@end